René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
gmake variables | ||
Variable assignmentdeferred assignmentvariable=value variable?=value
For example, wildcard expansion does not take place in the following variable definition, the string '*.c' is assigned to c_files.
c_files = *.c
These kind of variables are also called recursively expanded variables.
immediate assignmentvariable:=value
These kind of variables are also called simply expanded variables.
immediate or deferred assignment
In the following construct, it depends on the variable if the assignment is carried out immediatly or deferred.
variable+=value
See also immediateness in rules.
define
A variable can alternatively be defined with the define directive:
define var_name foo bar baz endef Automatic variables$?
All prerequisites that are newer than the target.
$^
All prerequisites.
$<
$< is the name of the first prerequisite.
$@
$@ is the automatic variable that holds the name of the target.
$*Variables set by gmakeCURDIR ???
See also the -C option.
MAKE ???
When a makefile invokes another make (mostly in a subdirectory), this other make should be invoked with
$(MAKE) so that is is executed even if the
-t option, the
-n option or the
-q option are used.
MAKEFILE_LISTMAKELEVEL
Used in recursivly invoked makes:
0 for the top level make, 1 for the first sub make and so on.
.VARIABLESOther variablesVPATH
Specifies directories in which to search for prerequisites.
See also the vpath directive.
?=VAR ?= VAL
is equal to
ifeq ($(origin VAR), undefined) VAR = VAL endif |