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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 212
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 54
Chapter 5: Writing Recipes in Rules 45
.ONESHELL:
SHELL = /usr/bin/perl
.SHELLFLAGS = -e
show :
@f = qw(a b c);
print "@f\n";
However, either of these alternatives would work properly:
.ONESHELL:
SHELL = /usr/bin/perl
.SHELLFLAGS = -e
show :
# Make sure "@" is not the first character on the first line
@f = qw(a b c);
print "@f\n";
or
.ONESHELL:
SHELL = /usr/bin/perl
.SHELLFLAGS = -e
show :
my @f = qw(a b c);
print "@f\n";
As a special feature, if SHELL is determined to be a POSIX-style shell, the special prefix
characters in “internal” recipe lines will removed before the recipe is processed. This feature
is intended to allow existing makefiles to add the .ONESHELL special target and still run
properly without extensive modifications. Since the special prefix characters are not legal
at the beginning of a line in a POSIX shell script this is not a loss in functionality. For
example, this works as expected:
.ONESHELL:
foo : bar/lose
@cd $(@D)
@gobble $(@F) > ../$@
Even with this special feature, however, makefiles with .ONESHELL will behave differently
in ways that could be noticeable. For example, normally if any line in the recipe fails, that
causes the rule to fail and no more recipe lines are processed. Under .ONESHELL a failure
of any but the final recipe line will not be noticed by make. You can modify .SHELLFLAGS
to add the -e option to the shell which will cause any failure anywhere in the command
line to cause the shell to fail, but this could itself cause your recipe to behave differently.
Ultimately you may need to harden your recipe lines to allow them to work with .ONESHELL.
5.3.2 Choosing the Shell
The program used as the shell is taken from the variable SHELL. If this variable is not set
in your makefile, the program /bin/sh is used as the shell. The argument(s) passed to the
shell are taken from the variable .SHELLFLAGS. The default value of .SHELLFLAGS is -c
normally, or -ec in POSIX-conforming mode.
Vista de página 54
1 2 ... 50 51 52 53 54 55 56 57 58 59 60 ... 211 212

Comentários a estes Manuais

Sem comentários