Roland Ver. 4.5 Technical Information Seite 54

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 212
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 53
44 GNU make
The -s or --silent flag to make prevents all echoing, as if all recipes started with
@’. A rule in the makefile for the special target .SILENT without prerequisites has the same
effect (see Section 4.8 [Special Built-in Target Names], page 32). .SILENT is essentially
obsolete since @ is more flexible.
5.3 Recipe Execution
When it is time to execute recipes to update a target, they are executed by invoking a new
sub-shell for each line of the recipe, unless the .ONESHELL special target is in effect (see
Section 5.3.1 [Using One Shell], page 44) (In practice, make may take shortcuts that do not
affect the results.)
Please note: this implies that setting shell variables and invoking shell commands such
as cd that set a context local to each process will not affect the following lines in the recipe.
1
If you want to use cd to affect the next statement, put both statements in a single recipe
line. Then make will invoke one shell to run the entire line, and the shell will execute the
statements in sequence. For example:
foo : bar/lose
cd $(@D) && gobble $(@F) > ../$@
Here we use the shell AND operator (&&) so that if the cd command fails, the script will fail
without trying to invoke the gobble command in the wrong directory, which could cause
problems (in this case it would certainly cause ../foo to be truncated, at least).
5.3.1 Using One Shell
Sometimes you would prefer that all the lines in the recipe be passed to a single invocation
of the shell. There are generally two situations where this is useful: first, it can improve
performance in makefiles where recipes consist of many command lines, by avoiding extra
processes. Second, you might want newlines to be included in your recipe command (for
example perhaps you are using a very different interpreter as your SHELL). If the .ONESHELL
special target appears anywhere in the makefile then all recipe lines for each target will be
provided to a single invocation of the shell. Newlines between recipe lines will be preserved.
For example:
.ONESHELL:
foo : bar/lose
cd $(@D)
gobble $(@F) > ../$@
would now work as expected even though the commands are on different recipe lines.
If .ONESHELL is provided, then only the first line of the recipe will be checked for the
special prefix characters (‘@’, -’, and +’). Subsequent lines will include the special char-
acters in the recipe line when the SHELL is invoked. If you want your recipe to start with
one of these special characters you’ll need to arrange for them to not be the first characters
on the first line, perhaps by adding a comment or similar. For example, this would be a
syntax error in Perl because the first @ is removed by make:
1
On MS-DOS, the value of current working directory is global, so changing it will affect the following
recipe lines on those systems.
Seitenansicht 53
1 2 ... 49 50 51 52 53 54 55 56 57 58 59 ... 211 212

Kommentare zu diesen Handbüchern

Keine Kommentare