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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 212
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 63
54 GNU make
5.7.3 Communicating Options to a Sub-make
Flags such as -s and -k are passed automatically to the sub-make through the variable
MAKEFLAGS. This variable is set up automatically by make to contain the flag letters that
make received. Thus, if you do make -ks then MAKEFLAGS gets the value ks’.
As a consequence, every sub-make gets a value for MAKEFLAGS in its environment. In
response, it takes the flags from that value and processes them as if they had been given as
arguments. See Section 9.7 [Summary of Options], page 104.
Likewise variables defined on the command line are passed to the sub-make through
MAKEFLAGS. Words in the value of MAKEFLAGS that contain =’, make treats as variable
definitions just as if they appeared on the command line. See Section 9.5 [Overriding
Variables], page 103.
The options -C’, -f’, -o’, and -W are not put into MAKEFLAGS; these options are not
passed down.
The ‘-j’ option is a special case (see Section 5.4 [Parallel Execution], page 47). If you set
it to some numeric value ‘N’ and your operating system supports it (most any UNIX system
will; others typically won’t), the parent make and all the sub-makes will communicate to
ensure that there are only N jobs running at the same time between them all. Note that
any job that is marked recursive (see Section 9.3 [Instead of Executing Recipes], page 101)
doesn’t count against the total jobs (otherwise we could get ‘N’ sub-makes running and have
no slots left over for any real work!)
If your operating system doesn’t support the above communication, then ‘-j 1’ is always
put into MAKEFLAGS instead of the value you specified. This is because if the -j option
were passed down to sub-makes, you would get many more jobs running in parallel than
you asked for. If you give -j with no numeric argument, meaning to run as many jobs as
possible in parallel, this is passed down, since multiple infinities are no more than one.
If you do not want to pass the other flags down, you must change the value of MAKEFLAGS,
like this:
subsystem:
cd subdir && $(MAKE) MAKEFLAGS=
The command line variable definitions really appear in the variable MAKEOVERRIDES,
and MAKEFLAGS contains a reference to this variable. If you do want to pass flags down
normally, but don’t want to pass down the command line variable definitions, you can reset
MAKEOVERRIDES to empty, like this:
MAKEOVERRIDES =
This is not usually useful to do. However, some systems have a small fixed limit on the
size of the environment, and putting so much information into the value of MAKEFLAGS can
exceed it. If you see the error message Arg list too long’, this may be the problem. (For
strict compliance with POSIX.2, changing MAKEOVERRIDES does not affect MAKEFLAGS if the
special target .POSIX appears in the makefile. You probably do not care about this.)
A similar variable MFLAGS exists also, for historical compatibility. It has the same
value as MAKEFLAGS except that it does not contain the command line variable defini-
tions, and it always begins with a hyphen unless it is empty (MAKEFLAGS begins with
a hyphen only when it begins with an option that has no single-letter version, such as
Vista de página 63
1 2 ... 59 60 61 62 63 64 65 66 67 68 69 ... 211 212

Comentários a estes Manuais

Sem comentários