Roland Ver. 4.5 Informações Técnicas Página 144

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 212
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 143
134 GNU make
character
A printable character is converted to the same character.
string A string containing only printable characters is converted to the same string.
list A list is converted recursively according to the above rules. This implies that
any structured list will be flattened (that is, a result of ’(a b (c d) e)’ will be
converted to the make string a b c d e’).
other Any other Guile type results in an error. In future versions of make, other Guile
types may be converted.
The translation of #f (to the empty string) and #t (to the non-empty string #t’) is
designed to allow you to use Guile boolean results directly as make boolean conditions. For
example:
$(if $(guile (access? "myfile" R_OK)),$(info myfile exists))
As a consequence of these conversion rules you must consider the result of your Guile
script, as that result will be converted into a string and parsed by make. If there is no
natural result for the script (that is, the script exists solely for its side-effects), you should
add #f as the final expression in order to avoid syntax errors in your makefile.
12.1.2 Interfaces from Guile to make
In addition to the guile function available in makefiles, make exposes some procedures for
use in your Guile scripts. At startup make creates a new Guile module, gnu make, and
exports these procedures as public interfaces from that module:
gmk-expand
This procedure takes a single argument which is converted into a string. The
string is expanded by make using normal make expansion rules. The result of
the expansion is converted into a Guile string and provided as the result of the
procedure.
gmk-eval This procedure takes a single argument which is converted into a string. The
string is evaluated by make as if it were a makefile. This is the same capability
available via the eval function (see Section 8.9 [Eval Function], page 93). The
result of the gmk-eval procedure is always the empty string.
Note that gmk-eval is not quite the same as using gmk-expand with the eval
function: in the latter case the evaluated string will be expanded twice; first by
gmk-expand, then again by the eval function.
12.1.3 Example Using Guile in make
Here is a very simple example using GNU Guile to manage writing to a file. These Guile
procedures simply open a file, allow writing to the file (one string per line), and close the file.
Note that because we cannot store complex values such as Guile ports in make variables,
we’ll keep the port as a global variable in the Guile interpreter.
You can create Guile functions easily using define/endef to create a Guile script, then
use the guile function to internalize it:
Vista de página 143
1 2 ... 139 140 141 142 143 144 145 146 147 148 149 ... 211 212

Comentários a estes Manuais

Sem comentários