[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This appendix summarizes the directives, text manipulation functions,
and special variables which GNU make
understands.
See section 4.9 Special Built-in Target Names, Catalogue of Implicit Rules,
and Summary of Options,
for other summaries.
Here is a summary of the directives GNU make
recognizes:
define variable
endef
Define a multi-line, recursively-expanded variable.
See section 5.7 Defining Canned Command Sequences.
ifdef variable
ifndef variable
ifeq (a,b)
ifeq "a" "b"
ifeq 'a' 'b'
ifneq (a,b)
ifneq "a" "b"
ifneq 'a' 'b'
else
endif
Conditionally evaluate part of the makefile.
See section 7. Conditional Parts of Makefiles.
include file
-include file
sinclude file
Include another makefile.
See section Including Other Makefiles.
override variable = value
override variable := value
override variable += value
override variable ?= value
override define variable
endef
Define a variable, overriding any previous definition, even one from
the command line.
See section The override
Directive.
export
Tell make
to export all variables to child processes by default.
See section Communicating Variables to a Sub-make
.
export variable
export variable = value
export variable := value
export variable += value
export variable ?= value
unexport variable
make
whether or not to export a particular variable to child
processes.make
.
vpath pattern path
vpath
Directive.
vpath pattern
vpath
vpath
directive.
Here is a summary of the text manipulation functions (see section 8. Functions for Transforming Text):
$(subst from,to,text)
$(patsubst pattern,replacement,text)
$(strip string)
$(findstring find,text)
$(filter pattern...,text)
$(filter-out pattern...,text)
$(sort list)
$(dir names...)
$(notdir names...)
$(suffix names...)
$(basename names...)
$(addsuffix suffix,names...)
$(addprefix prefix,names...)
$(join list1,list2)
$(word n,text)
$(words text)
$(wordlist s,e,text)
$(firstword names...)
$(wildcard pattern...)
wildcard
.
$(error text...)
When this function is evaluated, make
generates a fatal error
with the message text.
See section Functions That Control Make.
$(warning text...)
When this function is evaluated, make
generates a warning with
the message text.
See section Functions That Control Make.
$(shell command)
Execute a shell command and return its output.
See section The shell
Function.
$(origin variable)
Return a string describing how the make
variable variable was
defined.
See section The origin
Function.
$(foreach var,words,text)
Evaluate text with var bound to each word in words,
and concatenate the results.
See section The foreach
Function.
$(call var,param,...)
Evaluate the variable var replacing any references to $(1)
,
$(2)
with the first, second, etc. param values.
See section The call
Function.
Here is a summary of the automatic variables. See section Automatic Variables, for full information.
$@
$%
$<
$?
make
to Update Archive Files).
$^
$+
make
to Update Archive Files). The value of $^
omits duplicate
prerequisites, while $+
retains them and preserves their order.
$*
$(@D)
$(@F)
$@
.
$(*D)
$(*F)
$*
.
$(%D)
$(%F)
$%
.
$(<D)
$(<F)
$<
.
$(^D)
$(^F)
$^
.
$(+D)
$(+F)
$+
.
$(?D)
$(?F)
$?
.
These variables are used specially by GNU make
:
MAKEFILES
Makefiles to be read on every invocation of make
.
See section The Variable MAKEFILES
.
VPATH
Directory search path for files not found in the current directory.
See section VPATH
Search Path for All Prerequisites.
SHELL
The name of the system default command interpreter, usually `/bin/sh'.
You can set SHELL
in the makefile to change the shell used to run
commands. See section Command Execution.
MAKESHELL
On MS-DOS only, the name of the command interpreter that is to be used
by make
. This value takes precedence over the value of
SHELL
. See section MAKESHELL variable.
MAKE
The name with which make
was invoked.
Using this variable in commands has special meaning.
See section How the MAKE
Variable Works.
MAKELEVEL
The number of levels of recursion (sub-make
s).
See section 5.6.2 Communicating Variables to a Sub-make
.
MAKEFLAGS
The flags given to make
. You can set this in the environment or
a makefile to set flags.
See section Communicating Options to a Sub-make
.
It is never appropriate to use MAKEFLAGS
directly on a
command line: its contents may not be quoted correctly for use in the
shell. Always allow recursive make
's to obtain these values
through the environment from its parent.
MAKECMDGOALS
The targets given to make
on the command line. Setting this
variable has no effect on the operation of make
.
See section Arguments to Specify the Goals.
CURDIR
Set to the pathname of the current working directory (after all
-C
options are processed, if any). Setting this variable has no
effect on the operation of make
.
See section Recursive Use of make
.
SUFFIXES
The default list of suffixes before make
reads any makefiles.
.LIBPATTERNS
make
searches for, and their
order.[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |