52 GNU make
lines containing MAKE are executed normally despite the presence of a flag that causes most
recipes not to be run. The usual MAKEFLAGS mechanism passes the flags to the sub-make
(see Section 5.7.3 [Communicating Options to a Sub-make], page 54), so your request to
touch the files, or print the recipes, is propagated to the subsystem.
5.7.2 Communicating Variables to a Sub-make
Variable values of the top-level make can be passed to the sub-make through the environment
by explicit request. These variables are defined in the sub-make as defaults, but they do
not override variables defined in the makefile used by the sub-make unless you use the ‘-e’
switch (see Section 9.7 [Summary of Options], page 104).
To pass down, or export, a variable, make adds the variable and its value to the envi-
ronment for running each line of the recipe. The sub-make, in turn, uses the environment
to initialize its table of variable values. See Section 6.10 [Variables from the Environment],
page 70.
Except by explicit request, make exports a variable only if it is either defined in the
environment initially or set on the command line, and if its name consists only of let-
ters, numbers, and underscores. Some shells cannot cope with environment variable names
consisting of characters other than letters, numbers, and underscores.
The value of the make variable SHELL is not exported. Instead, the value of the SHELL
variable from the invoking environment is passed to the sub-make. You can force make to
export its value for SHELL by using the export directive, described below. See Section 5.3.2
[Choosing the Shell], page 45.
The special variable MAKEFLAGS is always exported (unless you unexport it). MAKEFILES
is exported if you set it to anything.
make automatically passes down variable values that were defined on the command line,
by putting them in the MAKEFLAGS variable. See the next section.
Variables are not normally passed down if they were created by default by make (see
Section 10.3 [Variables Used by Implicit Rules], page 115). The sub-make will define these
for itself.
If you want to export specific variables to a sub-make, use the export directive, like this:
export variable ...
If you want to prevent a variable from being exported, use the unexport directive, like this:
unexport variable ...
In both of these forms, the arguments to export and unexport are expanded, and so could
be variables or functions which expand to a (list of) variable names to be (un)exported.
As a convenience, you can define a variable and export it at the same time by doing:
export variable = value
has the same result as:
variable = value
export variable
and
export variable := value
has the same result as:
Comentários a estes Manuais