Environment variables are read and added to the
macro definitions each time make executes.
Precedence is a prime consideration in doing this properly.
The following describes make's interaction with the environment.
make automatically defines a macro, MAKEFLAGS,
containing the command-line option flags given in the invocation
The intent of the MAKEFLAGS macro, upon startup, is
to set environment variables to be used by successive invocations
When executed, make assigns macro definitions in
the following order:
The priority of assignments is from least binding to most binding;
the precedence of assignments is:
Read the MAKEFLAGS environment variable.
If it is not present or null, the internal make
variable MAKEFLAGS is set to the null string.
Otherwise, each letter in MAKEFLAGS is assumed to
be an input flag argument and is processed as such.
(The only exceptions are the -f, -p,
and -r flags.)
Read the internal list of macro definitions.
Read the environment.
The environment variables are treated as macro
definitions and marked as exported (in the shell sense).
Read the makefile(s).
The assignments in the makefile(s) override the environment.
This order is chosen so that
it is possible to know what to expect by reading the makefile
However, if the -e command-line flag is used,
the environment overrides
the makefile assignments.
Therefore, if make -e ... is typed,
the variables in the environment override
the definitions in the makefile.
Also, MAKEFLAGS overrides the environment if assigned.
This is useful for further invocations of make
from the current makefile.
If the -e option is specified, the priority of assignments becomes:
This order is general enough to allow
a programmer to define a makefile or set of makefiles
whose parameters are dynamically definable.
Suggestions and warnings
Dynamic dependency parameters
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003