1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<h1 class="appendix"> Quick Reference</h1> <p>This appendix summarizes the directives, text manipulation functions, and special variables which GNU <code>make</code> understands. See <a href="special-targets">Special Targets</a>, <a href="catalogue-of-rules">Catalogue of Built-In Rules</a>, and <a href="options-summary">Summary of Options</a>, for other summaries. </p> <p>Here is a summary of the directives GNU <code>make</code> recognizes: </p> <dl compact> <dt id="define variable"><code>define <var>variable</var></code></dt> <dt id="define variable ="><code>define <var>variable</var> =</code></dt> <dt id="define variable :="><code>define <var>variable</var> :=</code></dt> <dt id="define variable ::="><code>define <var>variable</var> ::=</code></dt> <dt id="define variable :::="><code>define <var>variable</var> :::=</code></dt> <dt id="define variable +="><code>define <var>variable</var> +=</code></dt> <dt id="define variable ?="><code>define <var>variable</var> ?=</code></dt> <dt id="endef"><code>endef</code></dt> <dd>
<p>Define multi-line variables. See <a href="multi_002dline">Multi-Line</a>. </p> </dd> <dt id="undefine variable"><code>undefine <var>variable</var></code></dt> <dd>
<p>Undefining variables. See <a href="undefine-directive">Undefine Directive</a>. </p> </dd> <dt id="ifdef variable"><code>ifdef <var>variable</var></code></dt> <dt id="ifndef variable"><code>ifndef <var>variable</var></code></dt> <dt id="ifeq (a,b)"><code>ifeq (<var>a</var>,<var>b</var>)</code></dt> <dt id='ifeq "a" "b"'><code>ifeq "<var>a</var>" "<var>b</var>"</code></dt> <dt id="ifeq 'a' 'b'"><code>ifeq '<var>a</var>' '<var>b</var>'</code></dt> <dt id="ifneq (a,b)"><code>ifneq (<var>a</var>,<var>b</var>)</code></dt> <dt id='ifneq "a" "b"'><code>ifneq "<var>a</var>" "<var>b</var>"</code></dt> <dt id="ifneq 'a' 'b'"><code>ifneq '<var>a</var>' '<var>b</var>'</code></dt> <dt id="else"><code>else</code></dt> <dt id="endif"><code>endif</code></dt> <dd>
<p>Conditionally evaluate part of the makefile. See <a href="conditionals">Conditionals</a>. </p> </dd> <dt id="include file"><code>include <var>file</var></code></dt> <dt id="-include file"><code>-include <var>file</var></code></dt> <dt id="sinclude file"><code>sinclude <var>file</var></code></dt> <dd>
<p>Include another makefile. See <a href="include">Including Other Makefiles</a>. </p> </dd> <dt id="override variable-assignment"><code>override <var>variable-assignment</var></code></dt> <dd>
<p>Define a variable, overriding any previous definition, even one from the command line. See <a href="override-directive">The <code>override</code> Directive</a>. </p> </dd> <dt id="export"><code>export</code></dt> <dd>
<p>Tell <code>make</code> to export all variables to child processes by default. See <a href="variables_002frecursion">Communicating Variables to a Sub-<code>make</code></a>. </p> </dd> <dt id="export variable"><code>export <var>variable</var></code></dt> <dt id="export variable-assignment"><code>export <var>variable-assignment</var></code></dt> <dt id="unexport variable"><code>unexport <var>variable</var></code></dt> <dd>
<p>Tell <code>make</code> whether or not to export a particular variable to child processes. See <a href="variables_002frecursion">Communicating Variables to a Sub-<code>make</code></a>. </p> </dd> <dt id="private variable-assignment"><code>private <var>variable-assignment</var></code></dt> <dd>
<p>Do not allow this variable assignment to be inherited by prerequisites. See <a href="suppressing-inheritance">Suppressing Inheritance</a>. </p> </dd> <dt id="vpath pattern path"><code>vpath <var>pattern</var> <var>path</var></code></dt> <dd>
<p>Specify a search path for files matching a ‘<samp>%</samp>’ pattern. See <a href="selective-search">The <code>vpath</code> Directive</a>. </p> </dd> <dt id="vpath pattern"><code>vpath <var>pattern</var></code></dt> <dd>
<p>Remove all search paths previously specified for <var>pattern</var>. </p> </dd> <dt id="vpath"><code>vpath</code></dt> <dd><p>Remove all search paths previously specified in any <code>vpath</code> directive. </p></dd> </dl> <p>Here is a summary of the built-in functions (see <a href="functions">Functions</a>): </p> <dl compact> <dt id="$(subst from,to,text)"><code>$(subst <var>from</var>,<var>to</var>,<var>text</var>)</code></dt> <dd>
<p>Replace <var>from</var> with <var>to</var> in <var>text</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(patsubst pattern,replacement,text)"><code>$(patsubst <var>pattern</var>,<var>replacement</var>,<var>text</var>)</code></dt> <dd>
<p>Replace words matching <var>pattern</var> with <var>replacement</var> in <var>text</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(strip string)"><code>$(strip <var>string</var>)</code></dt> <dd>
<p>Remove excess whitespace characters from <var>string</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(findstring find,text)"><code>$(findstring <var>find</var>,<var>text</var>)</code></dt> <dd>
<p>Locate <var>find</var> in <var>text</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(filter pattern…,text)"><code>$(filter <var>pattern</var>…,<var>text</var>)</code></dt> <dd>
<p>Select words in <var>text</var> that match one of the <var>pattern</var> words. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(filter-out pattern…,text)"><code>$(filter-out <var>pattern</var>…,<var>text</var>)</code></dt> <dd>
<p>Select words in <var>text</var> that <em>do not</em> match any of the <var>pattern</var> words. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(sort list)"><code>$(sort <var>list</var>)</code></dt> <dd>
<p>Sort the words in <var>list</var> lexicographically, removing duplicates. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(word n,text)"><code>$(word <var>n</var>,<var>text</var>)</code></dt> <dd>
<p>Extract the <var>n</var>th word (one-origin) of <var>text</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(words text)"><code>$(words <var>text</var>)</code></dt> <dd>
<p>Count the number of words in <var>text</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(wordlist s,e,text)"><code>$(wordlist <var>s</var>,<var>e</var>,<var>text</var>)</code></dt> <dd>
<p>Returns the list of words in <var>text</var> from <var>s</var> to <var>e</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(firstword names…)"><code>$(firstword <var>names</var>…)</code></dt> <dd>
<p>Extract the first word of <var>names</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(lastword names…)"><code>$(lastword <var>names</var>…)</code></dt> <dd>
<p>Extract the last word of <var>names</var>. See <a href="text-functions">Functions for String Substitution and Analysis</a>. </p> </dd> <dt id="$(dir names…)"><code>$(dir <var>names</var>…)</code></dt> <dd>
<p>Extract the directory part of each file name. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(notdir names…)"><code>$(notdir <var>names</var>…)</code></dt> <dd>
<p>Extract the non-directory part of each file name. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(suffix names…)"><code>$(suffix <var>names</var>…)</code></dt> <dd>
<p>Extract the suffix (the last ‘<samp>.</samp>’ and following characters) of each file name. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(basename names…)"><code>$(basename <var>names</var>…)</code></dt> <dd>
<p>Extract the base name (name without suffix) of each file name. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(addsuffix suffix,names…)"><code>$(addsuffix <var>suffix</var>,<var>names</var>…)</code></dt> <dd>
<p>Append <var>suffix</var> to each word in <var>names</var>. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(addprefix prefix,names…)"><code>$(addprefix <var>prefix</var>,<var>names</var>…)</code></dt> <dd>
<p>Prepend <var>prefix</var> to each word in <var>names</var>. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(join list1,list2)"><code>$(join <var>list1</var>,<var>list2</var>)</code></dt> <dd>
<p>Join two parallel lists of words. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(wildcard pattern…)"><code>$(wildcard <var>pattern</var>…)</code></dt> <dd>
<p>Find file names matching a shell file name pattern (<em>not</em> a ‘<samp>%</samp>’ pattern). See <a href="wildcard-function">The Function <code>wildcard</code></a>. </p> </dd> <dt id="$(realpath names…)"><code>$(realpath <var>names</var>…)</code></dt> <dd>
<p>For each file name in <var>names</var>, expand to an absolute name that does not contain any <code>.</code>, <code>..</code>, nor symlinks. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(abspath names…)"><code>$(abspath <var>names</var>…)</code></dt> <dd>
<p>For each file name in <var>names</var>, expand to an absolute name that does not contain any <code>.</code> or <code>..</code> components, but preserves symlinks. See <a href="file-name-functions">Functions for File Names</a>. </p> </dd> <dt id="$(error text…)"><code>$(error <var>text</var>…)</code></dt> <dd>
<p>When this function is evaluated, <code>make</code> generates a fatal error with the message <var>text</var>. See <a href="make-control-functions">Functions That Control Make</a>. </p> </dd> <dt id="$(warning text…)"><code>$(warning <var>text</var>…)</code></dt> <dd>
<p>When this function is evaluated, <code>make</code> generates a warning with the message <var>text</var>. See <a href="make-control-functions">Functions That Control Make</a>. </p> </dd> <dt id="$(shell command)"><code>$(shell <var>command</var>)</code></dt> <dd>
<p>Execute a shell command and return its output. See <a href="shell-function">The <code>shell</code> Function</a>. </p> </dd> <dt id="$(origin variable)"><code>$(origin <var>variable</var>)</code></dt> <dd>
<p>Return a string describing how the <code>make</code> variable <var>variable</var> was defined. See <a href="origin-function">The <code>origin</code> Function</a>. </p> </dd> <dt id="$(flavor variable)"><code>$(flavor <var>variable</var>)</code></dt> <dd>
<p>Return a string describing the flavor of the <code>make</code> variable <var>variable</var>. See <a href="flavor-function">The <code>flavor</code> Function</a>. </p> </dd> <dt id="$(let var [var ...],words,text)"><code>$(let <var>var</var> [<var>var</var> ...],<var>words</var>,<var>text</var>)</code></dt> <dd>
<p>Evaluate <var>text</var> with the <var>var</var>s bound to the words in <var>words</var>. See <a href="let-function">The <code>let</code> Function</a>. </p> </dd> <dt id="$(foreach var,words,text)"><code>$(foreach <var>var</var>,<var>words</var>,<var>text</var>)</code></dt> <dd>
<p>Evaluate <var>text</var> with <var>var</var> bound to each word in <var>words</var>, and concatenate the results. See <a href="foreach-function">The <code>foreach</code> Function</a>. </p> </dd> <dt id="$(if condition,then-part[,else-part])"><code>$(if <var>condition</var>,<var>then-part</var>[,<var>else-part</var>])</code></dt> <dd>
<p>Evaluate the condition <var>condition</var>; if it’s non-empty substitute the expansion of the <var>then-part</var> otherwise substitute the expansion of the <var>else-part</var>. See <a href="conditional-functions">Functions for Conditionals</a>. </p> </dd> <dt id="$(or condition1[,condition2[,condition3…]])"><code>$(or <var>condition1</var>[,<var>condition2</var>[,<var>condition3</var>…]])</code></dt> <dd>
<p>Evaluate each condition <var>conditionN</var> one at a time; substitute the first non-empty expansion. If all expansions are empty, substitute the empty string. See <a href="conditional-functions">Functions for Conditionals</a>. </p> </dd> <dt id="$(and condition1[,condition2[,condition3…]])"><code>$(and <var>condition1</var>[,<var>condition2</var>[,<var>condition3</var>…]])</code></dt> <dd>
<p>Evaluate each condition <var>conditionN</var> one at a time; if any expansion results in the empty string substitute the empty string. If all expansions result in a non-empty string, substitute the expansion of the last <var>condition</var>. See <a href="conditional-functions">Functions for Conditionals</a>. </p> </dd> <dt id="$(intcmp lhs,rhs[,lt-part[,eq-part[,gt-part]]])"><code>$(intcmp <var>lhs</var>,<var>rhs</var>[,<var>lt-part</var>[,<var>eq-part</var>[,<var>gt-part</var>]]])</code></dt> <dd>
<p>Compare <var>lhs</var> and <var>rhs</var> numerically; substitute the expansion of <var>lt-part</var>, <var>eq-part</var>, or <var>gt-part</var> depending on whether the left-hand side is less-than, equal-to, or greater-than the right-hand side, respectively. See <a href="conditional-functions">Functions for Conditionals</a>. </p> </dd> <dt id="$(call var,param,…)"><code>$(call <var>var</var>,<var>param</var>,…)</code></dt> <dd>
<p>Evaluate the variable <var>var</var> replacing any references to <code>$(1)</code>, <code>$(2)</code> with the first, second, etc. <var>param</var> values. See <a href="call-function">The <code>call</code> Function</a>. </p> </dd> <dt id="$(eval text)"><code>$(eval <var>text</var>)</code></dt> <dd>
<p>Evaluate <var>text</var> then read the results as makefile commands. Expands to the empty string. See <a href="eval-function">The <code>eval</code> Function</a>. </p> </dd> <dt id="$(file op filename,text)"><code>$(file <var>op</var> <var>filename</var>,<var>text</var>)</code></dt> <dd>
<p>Expand the arguments, then open the file <var>filename</var> using mode <var>op</var> and write <var>text</var> to that file. See <a href="file-function">The <code>file</code> Function</a>. </p> </dd> <dt id="$(value var)"><code>$(value <var>var</var>)</code></dt> <dd><p>Evaluates to the contents of the variable <var>var</var>, with no expansion performed on it. See <a href="value-function">The <code>value</code> Function</a>. </p></dd> </dl> <p>Here is a summary of the automatic variables. See <a href="automatic-variables">Automatic Variables</a>, for full information. </p> <dl compact> <dt id="$@"><code>$@</code></dt> <dd>
<p>The file name of the target. </p> </dd> <dt id="$%"><code>$%</code></dt> <dd>
<p>The target member name, when the target is an archive member. </p> </dd> <dt id="$<"><code>$<</code></dt> <dd>
<p>The name of the first prerequisite. </p> </dd> <dt id="$?"><code>$?</code></dt> <dd>
<p>The names of all the prerequisites that are newer than the target, with spaces between them. For prerequisites which are archive members, only the named member is used (see <a href="archives">Archives</a>). </p> </dd> <dt id="$^"><code>$^</code></dt> <dt id="$+"><code>$+</code></dt> <dd>
<p>The names of all the prerequisites, with spaces between them. For prerequisites which are archive members, only the named member is used (see <a href="archives">Archives</a>). The value of <code>$^</code> omits duplicate prerequisites, while <code>$+</code> retains them and preserves their order. </p> </dd> <dt id="$*"><code>$*</code></dt> <dd>
<p>The stem with which an implicit rule matches (see <a href="pattern-match">How Patterns Match</a>). </p> </dd> <dt id="$(@D)"><code>$(@D)</code></dt> <dt id="$(@F)"><code>$(@F)</code></dt> <dd>
<p>The directory part and the file-within-directory part of <code>$@</code>. </p> </dd> <dt id="$(*D)"><code>$(*D)</code></dt> <dt id="$(*F)"><code>$(*F)</code></dt> <dd>
<p>The directory part and the file-within-directory part of <code>$*</code>. </p> </dd> <dt id="$(%D)"><code>$(%D)</code></dt> <dt id="$(%F)"><code>$(%F)</code></dt> <dd>
<p>The directory part and the file-within-directory part of <code>$%</code>. </p> </dd> <dt id="$(<D)"><code>$(<D)</code></dt> <dt id="$(<F)"><code>$(<F)</code></dt> <dd>
<p>The directory part and the file-within-directory part of <code>$<</code>. </p> </dd> <dt id="$(^D)"><code>$(^D)</code></dt> <dt id="$(^F)"><code>$(^F)</code></dt> <dd>
<p>The directory part and the file-within-directory part of <code>$^</code>. </p> </dd> <dt id="$(+D)"><code>$(+D)</code></dt> <dt id="$(+F)"><code>$(+F)</code></dt> <dd>
<p>The directory part and the file-within-directory part of <code>$+</code>. </p> </dd> <dt id="$(?D)"><code>$(?D)</code></dt> <dt id="$(?F)"><code>$(?F)</code></dt> <dd><p>The directory part and the file-within-directory part of <code>$?</code>. </p></dd> </dl> <p>These variables are used specially by GNU <code>make</code>: </p> <dl compact> <dt id="MAKEFILES"><code>MAKEFILES</code></dt> <dd> <p>Makefiles to be read on every invocation of <code>make</code>. See <a href="makefiles-variable">The Variable <code>MAKEFILES</code></a>. </p> </dd> <dt id="VPATH"><code>VPATH</code></dt> <dd> <p>Directory search path for files not found in the current directory. See <a href="general-search"><code>VPATH</code> Search Path for All Prerequisites</a>. </p> </dd> <dt id="SHELL"><code>SHELL</code></dt> <dd> <p>The name of the system default command interpreter, usually <samp>/bin/sh</samp>. You can set <code>SHELL</code> in the makefile to change the shell used to run recipes. See <a href="execution">Recipe Execution</a>. The <code>SHELL</code> variable is handled specially when importing from and exporting to the environment. See <a href="choosing-the-shell">Choosing the Shell</a>. </p> </dd> <dt id="MAKESHELL"><code>MAKESHELL</code></dt> <dd> <p>On MS-DOS only, the name of the command interpreter that is to be used by <code>make</code>. This value takes precedence over the value of <code>SHELL</code>. See <a href="execution">MAKESHELL variable</a>. </p> </dd> <dt id="MAKE"><code>MAKE</code></dt> <dd> <p>The name with which <code>make</code> was invoked. Using this variable in recipes has special meaning. See <a href="make-variable">How the <code>MAKE</code> Variable Works</a>. </p> </dd> <dt id="MAKE_VERSION"><code>MAKE_VERSION</code></dt> <dd> <p>The built-in variable ‘<samp>MAKE_VERSION</samp>’ expands to the version number of the GNU <code>make</code> program. </p> </dd> <dt id="MAKE_HOST"><code>MAKE_HOST</code></dt> <dd> <p>The built-in variable ‘<samp>MAKE_HOST</samp>’ expands to a string representing the host that GNU <code>make</code> was built to run on. </p> </dd> <dt id="MAKELEVEL"><code>MAKELEVEL</code></dt> <dd> <p>The number of levels of recursion (sub-<code>make</code>s). See <a href="variables_002frecursion">Variables/Recursion</a>. </p> </dd> <dt id="MAKEFLAGS"><code>MAKEFLAGS</code></dt> <dd> <p>The flags given to <code>make</code>. You can set this in the environment or a makefile to set flags. See <a href="options_002frecursion">Communicating Options to a Sub-<code>make</code></a>. </p> <p>It is <em>never</em> appropriate to use <code>MAKEFLAGS</code> directly in a recipe line: its contents may not be quoted correctly for use in the shell. Always allow recursive <code>make</code>’s to obtain these values through the environment from its parent. </p> </dd> <dt id="GNUMAKEFLAGS"><code>GNUMAKEFLAGS</code></dt> <dd> <p>Other flags parsed by <code>make</code>. You can set this in the environment or a makefile to set <code>make</code> command-line flags. GNU <code>make</code> never sets this variable itself. This variable is only needed if you’d like to set GNU <code>make</code>-specific flags in a POSIX-compliant makefile. This variable will be seen by GNU <code>make</code> and ignored by other <code>make</code> implementations. It’s not needed if you only use GNU <code>make</code>; just use <code>MAKEFLAGS</code> directly. See <a href="options_002frecursion">Communicating Options to a Sub-<code>make</code></a>. </p> </dd> <dt id="MAKECMDGOALS"><code>MAKECMDGOALS</code></dt> <dd> <p>The targets given to <code>make</code> on the command line. Setting this variable has no effect on the operation of <code>make</code>. See <a href="goals">Arguments to Specify the Goals</a>. </p> </dd> <dt id="CURDIR"><code>CURDIR</code></dt> <dd> <p>Set to the absolute pathname of the current working directory (after all <code>-C</code> options are processed, if any). Setting this variable has no effect on the operation of <code>make</code>. See <a href="recursion">Recursive Use of <code>make</code></a>. </p> </dd> <dt id="SUFFIXES"><code>SUFFIXES</code></dt> <dd> <p>The default list of suffixes before <code>make</code> reads any makefiles. </p> </dd> <dt id=".LIBPATTERNS"><code>.LIBPATTERNS</code></dt> <dd><p>Defines the naming of the libraries <code>make</code> searches for, and their order. See <a href="libraries_002fsearch">Directory Search for Link Libraries</a>. </p></dd> </dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Free Software Foundation, Inc. <br>Licensed under the GNU Free Documentation License.<br>
<a href="https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html</a>
</p>
</div>
|