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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 212
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 106
Chapter 8: Functions for Transforming Text 97
8.13 The shell Function
The shell function is unlike any other function other than the wildcard function (see
Section 4.3.3 [The Function wildcard], page 24) in that it communicates with the world
outside of make.
The shell function performs the same function that backquotes (‘’) perform in most
shells: it does command expansion. This means that it takes as an argument a shell
command and evaluates to the output of the command. The only processing make does on
the result is to convert each newline (or carriage-return / newline pair) to a single space. If
there is a trailing (carriage-return and) newline it will simply be removed.
The commands run by calls to the shell function are run when the function calls are
expanded (see Section 3.7 [How make Reads a Makefile], page 16). Because this function
involves spawning a new shell, you should carefully consider the performance implications
of using the shell function within recursively expanded variables vs. simply expanded
variables (see Section 6.2 [The Two Flavors of Variables], page 60).
Here are some examples of the use of the shell function:
contents := $(shell cat foo)
sets contents to the contents of the file foo, with a space (rather than a newline) separating
each line.
files := $(shell echo *.c)
sets files to the expansion of *.c’. Unless make is using a very strange shell, this has the
same result as $(wildcard *.c) (as long as at least one .c file exists).
8.14 The guile Function
If GNU make is built with support for GNU Guile as an embedded extension language then
the guile function will be available. The guile function takes one argument which is first
expanded by make in the normal fashion, then passed to the GNU Guile evaluator. The
result of the evaluator is converted into a string and used as the expansion of the guile
function in the makefile. See Section 12.1 [GNU Guile Integration], page 133 for details on
writing extensions to make in Guile.
You can determine whether GNU Guile support is available by checking the .FEATURES
variable for the word guile.
Vista de página 106
1 2 ... 102 103 104 105 106 107 108 109 110 111 112 ... 211 212

Comentários a estes Manuais

Sem comentários