-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuick-Reference.html
More file actions
342 lines (275 loc) · 16.5 KB
/
Quick-Reference.html
File metadata and controls
342 lines (275 loc) · 16.5 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<html lang="en">
<head>
<title>GNU `make'</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU `make'">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="Quick%20Reference">Quick Reference</a>,
Next:<a rel="next" accesskey="n" href="Error-Messages.html#Error%20Messages">Error Messages</a>,
Previous:<a rel="previous" accesskey="p" href="Makefile-Conventions.html#Makefile%20Conventions">Makefile Conventions</a>,
Up:<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<h2 class="appendix">Quick Reference</h2>
<p>This appendix summarizes the directives, text manipulation functions,
and special variables which GNU <code>make</code> understands.
See <a href="Special-Targets.html#Special%20Targets">Special Targets</a>, <a href="Catalogue-of-Rules.html#Catalogue%20of%20Rules">Catalogue of Implicit Rules</a>,
and <a href="Options-Summary.html#Options%20Summary">Summary of Options</a>,
for other summaries.
<p>Here is a summary of the directives GNU <code>make</code> recognizes:
<dl>
<dt><code>define </code><var>variable</var><code></code>
<dd><dt><code>endef</code>
<dd>
Define a multi-line, recursively-expanded variable.<br>
See <a href="Sequences.html#Sequences">Sequences</a>.
<br><dt><code>ifdef </code><var>variable</var><code></code>
<dd><dt><code>ifndef </code><var>variable</var><code></code>
<dd><dt><code>ifeq (</code><var>a</var><code>,</code><var>b</var><code>)</code>
<dd><dt><code>ifeq "</code><var>a</var><code>" "</code><var>b</var><code>"</code>
<dd><dt><code>ifeq '</code><var>a</var><code>' '</code><var>b</var><code>'</code>
<dd><dt><code>ifneq (</code><var>a</var><code>,</code><var>b</var><code>)</code>
<dd><dt><code>ifneq "</code><var>a</var><code>" "</code><var>b</var><code>"</code>
<dd><dt><code>ifneq '</code><var>a</var><code>' '</code><var>b</var><code>'</code>
<dd><dt><code>else</code>
<dd><dt><code>endif</code>
<dd>
Conditionally evaluate part of the makefile.<br>
See <a href="Conditionals.html#Conditionals">Conditionals</a>.
<br><dt><code>include </code><var>file</var><code></code>
<dd><dt><code>-include </code><var>file</var><code></code>
<dd><dt><code>sinclude </code><var>file</var><code></code>
<dd>
Include another makefile.<br>
See <a href="Include.html#Include">Including Other Makefiles</a>.
<br><dt><code>override </code><var>variable</var><code> = </code><var>value</var><code></code>
<dd><dt><code>override </code><var>variable</var><code> := </code><var>value</var><code></code>
<dd><dt><code>override </code><var>variable</var><code> += </code><var>value</var><code></code>
<dd><dt><code>override </code><var>variable</var><code> ?= </code><var>value</var><code></code>
<dd><dt><code>override define </code><var>variable</var><code></code>
<dd><dt><code>endef</code>
<dd>
Define a variable, overriding any previous definition, even one from
the command line.<br>
See <a href="Override-Directive.html#Override%20Directive">The <code>override</code> Directive</a>.
<br><dt><code>export</code>
<dd>
Tell <code>make</code> to export all variables to child processes by default.<br>
See <a href="Variables-Recursion.html#Variables%2fRecursion">Communicating Variables to a Sub-<code>make</code></a>.
<br><dt><code>export </code><var>variable</var><code></code>
<dd><dt><code>export </code><var>variable</var><code> = </code><var>value</var><code></code>
<dd><dt><code>export </code><var>variable</var><code> := </code><var>value</var><code></code>
<dd><dt><code>export </code><var>variable</var><code> += </code><var>value</var><code></code>
<dd><dt><code>export </code><var>variable</var><code> ?= </code><var>value</var><code></code>
<dd><dt><code>unexport </code><var>variable</var><code></code>
<dd>Tell <code>make</code> whether or not to export a particular variable to child
processes.<br>
See <a href="Variables-Recursion.html#Variables%2fRecursion">Communicating Variables to a Sub-<code>make</code></a>.
<br><dt><code>vpath </code><var>pattern</var><code> </code><var>path</var><code></code>
<dd>Specify a search path for files matching a <code>%</code> pattern.<br>
See <a href="Selective-Search.html#Selective%20Search">The <code>vpath</code> Directive</a>.
<br><dt><code>vpath </code><var>pattern</var><code></code>
<dd>Remove all search paths previously specified for <var>pattern</var>.
<br><dt><code>vpath</code>
<dd>Remove all search paths previously specified in any <code>vpath</code>
directive.
</dl>
<p>Here is a summary of the text manipulation functions (see <a href="Functions.html#Functions">Functions</a>):
<dl>
<dt><code>$(subst </code><var>from</var><code>,</code><var>to</var><code>,</code><var>text</var><code>)</code>
<dd>Replace <var>from</var> with <var>to</var> in <var>text</var>.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(patsubst </code><var>pattern</var><code>,</code><var>replacement</var><code>,</code><var>text</var><code>)</code>
<dd>Replace words matching <var>pattern</var> with <var>replacement</var> in <var>text</var>.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(strip </code><var>string</var><code>)</code>
<dd>Remove excess whitespace characters from <var>string</var>.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(findstring </code><var>find</var><code>,</code><var>text</var><code>)</code>
<dd>Locate <var>find</var> in <var>text</var>.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(filter </code><var>pattern</var><code>...,</code><var>text</var><code>)</code>
<dd>Select words in <var>text</var> that match one of the <var>pattern</var> words.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(filter-out </code><var>pattern</var><code>...,</code><var>text</var><code>)</code>
<dd>Select words in <var>text</var> that <em>do not</em> match any of the <var>pattern</var> words.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(sort </code><var>list</var><code>)</code>
<dd>Sort the words in <var>list</var> lexicographically, removing duplicates.<br>
See <a href="Text-Functions.html#Text%20Functions">Functions for String Substitution and Analysis</a>.
<br><dt><code>$(dir </code><var>names</var><code>...)</code>
<dd>Extract the directory part of each file name.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(notdir </code><var>names</var><code>...)</code>
<dd>Extract the non-directory part of each file name.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(suffix </code><var>names</var><code>...)</code>
<dd>Extract the suffix (the last <code>.</code> and following characters) of each file name.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(basename </code><var>names</var><code>...)</code>
<dd>Extract the base name (name without suffix) of each file name.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(addsuffix </code><var>suffix</var><code>,</code><var>names</var><code>...)</code>
<dd>Append <var>suffix</var> to each word in <var>names</var>.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(addprefix </code><var>prefix</var><code>,</code><var>names</var><code>...)</code>
<dd>Prepend <var>prefix</var> to each word in <var>names</var>.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(join </code><var>list1</var><code>,</code><var>list2</var><code>)</code>
<dd>Join two parallel lists of words.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(word </code><var>n</var><code>,</code><var>text</var><code>)</code>
<dd>Extract the <var>n</var>th word (one-origin) of <var>text</var>.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(words </code><var>text</var><code>)</code>
<dd>Count the number of words in <var>text</var>.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(wordlist </code><var>s</var><code>,</code><var>e</var><code>,</code><var>text</var><code>)</code>
<dd>Returns the list of words in <var>text</var> from <var>s</var> to <var>e</var>.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(firstword </code><var>names</var><code>...)</code>
<dd>Extract the first word of <var>names</var>.<br>
See <a href="File-Name-Functions.html#File%20Name%20Functions">Functions for File Names</a>.
<br><dt><code>$(wildcard </code><var>pattern</var><code>...)</code>
<dd>Find file names matching a shell file name pattern (<em>not</em> a
<code>%</code> pattern).<br>
See <a href="Wildcard-Function.html#Wildcard%20Function">The Function <code>wildcard</code></a>.
<br><dt><code>$(error </code><var>text</var><code>...)</code>
<dd>
When this function is evaluated, <code>make</code> generates a fatal error
with the message <var>text</var>.<br>
See <a href="Make-Control-Functions.html#Make%20Control%20Functions">Functions That Control Make</a>.
<br><dt><code>$(warning </code><var>text</var><code>...)</code>
<dd>
When this function is evaluated, <code>make</code> generates a warning with
the message <var>text</var>.<br>
See <a href="Make-Control-Functions.html#Make%20Control%20Functions">Functions That Control Make</a>.
<br><dt><code>$(shell </code><var>command</var><code>)</code>
<dd>
Execute a shell command and return its output.<br>
See <a href="Shell-Function.html#Shell%20Function">The <code>shell</code> Function</a>.
<br><dt><code>$(origin </code><var>variable</var><code>)</code>
<dd>
Return a string describing how the <code>make</code> variable <var>variable</var> was
defined.<br>
See <a href="Origin-Function.html#Origin%20Function">The <code>origin</code> Function</a>.
<br><dt><code>$(foreach </code><var>var</var><code>,</code><var>words</var><code>,</code><var>text</var><code>)</code>
<dd>
Evaluate <var>text</var> with <var>var</var> bound to each word in <var>words</var>,
and concatenate the results.<br>
See <a href="Foreach-Function.html#Foreach%20Function">The <code>foreach</code> Function</a>.
<br><dt><code>$(call </code><var>var</var><code>,</code><var>param</var><code>,...)</code>
<dd>
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.<br>
See <a href="Call-Function.html#Call%20Function">The <code>call</code> Function</a>.
</dl>
<p>Here is a summary of the automatic variables.
See <a href="Automatic.html#Automatic">Automatic Variables</a>,
for full information.
<dl>
<dt><code>$@</code>
<dd>The file name of the target.
<br><dt><code>$%</code>
<dd>The target member name, when the target is an archive member.
<br><dt><code>$<</code>
<dd>The name of the first prerequisite.
<br><dt><code>$?</code>
<dd>The names of all the prerequisites that are
newer than the target, with spaces between them.
For prerequisites which are archive members, only
the member named is used (see <a href="Archives.html#Archives">Archives</a>).
<br><dt><code>$^</code>
<dd><dt><code>$+</code>
<dd>The names of all the prerequisites, with spaces between them. For
prerequisites which are archive members, only the member named is used
(see <a href="Archives.html#Archives">Archives</a>). The value of <code>$^</code> omits duplicate
prerequisites, while <code>$+</code> retains them and preserves their order.
<br><dt><code>$*</code>
<dd>The stem with which an implicit rule matches
(see <a href="Pattern-Match.html#Pattern%20Match">How Patterns Match</a>).
<br><dt><code>$(@D)</code>
<dd><dt><code>$(@F)</code>
<dd>The directory part and the file-within-directory part of <code>$@</code>.
<br><dt><code>$(*D)</code>
<dd><dt><code>$(*F)</code>
<dd>The directory part and the file-within-directory part of <code>$*</code>.
<br><dt><code>$(%D)</code>
<dd><dt><code>$(%F)</code>
<dd>The directory part and the file-within-directory part of <code>$%</code>.
<br><dt><code>$(<D)</code>
<dd><dt><code>$(<F)</code>
<dd>The directory part and the file-within-directory part of <code>$<</code>.
<br><dt><code>$(^D)</code>
<dd><dt><code>$(^F)</code>
<dd>The directory part and the file-within-directory part of <code>$^</code>.
<br><dt><code>$(+D)</code>
<dd><dt><code>$(+F)</code>
<dd>The directory part and the file-within-directory part of <code>$+</code>.
<br><dt><code>$(?D)</code>
<dd><dt><code>$(?F)</code>
<dd>The directory part and the file-within-directory part of <code>$?</code>.
</dl>
<p>These variables are used specially by GNU <code>make</code>:
<dl>
<dt><code>MAKEFILES</code>
<dd>
Makefiles to be read on every invocation of <code>make</code>.<br>
See <a href="MAKEFILES-Variable.html#MAKEFILES%20Variable">The Variable <code>MAKEFILES</code></a>.
<br><dt><code>VPATH</code>
<dd>
Directory search path for files not found in the current directory.<br>
See <a href="General-Search.html#General%20Search"><code>VPATH</code> Search Path for All Prerequisites</a>.
<br><dt><code>SHELL</code>
<dd>
The name of the system default command interpreter, usually <code>/bin/sh</code>.
You can set <code>SHELL</code> in the makefile to change the shell used to run
commands. See <a href="Execution.html#Execution">Command Execution</a>.
<br><dt><code>MAKESHELL</code>
<dd>
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.html#Execution">MAKESHELL variable</a>.
<br><dt><code>MAKE</code>
<dd>
The name with which <code>make</code> was invoked.
Using this variable in commands has special meaning.
See <a href="MAKE-Variable.html#MAKE%20Variable">How the <code>MAKE</code> Variable Works</a>.
<br><dt><code>MAKELEVEL</code>
<dd>
The number of levels of recursion (sub-<code>make</code>s).<br>
See <a href="Variables-Recursion.html#Variables%2fRecursion">Variables/Recursion</a>.
<br><dt><code>MAKEFLAGS</code>
<dd>
The flags given to <code>make</code>. You can set this in the environment or
a makefile to set flags.<br>
See <a href="Options-Recursion.html#Options%2fRecursion">Communicating Options to a Sub-<code>make</code></a>.
<p>It is <em>never</em> appropriate to use <code>MAKEFLAGS</code> directly on a
command 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.
<br><dt><code>MAKECMDGOALS</code>
<dd>
The targets given to <code>make</code> on the command line. Setting this
variable has no effect on the operation of <code>make</code>.<br>
See <a href="Goals.html#Goals">Arguments to Specify the Goals</a>.
<br><dt><code>CURDIR</code>
<dd>
Set to the 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>.<br>
See <a href="Recursion.html#Recursion">Recursive Use of <code>make</code></a>.
<br><dt><code>SUFFIXES</code>
<dd>
The default list of suffixes before <code>make</code> reads any makefiles.
<br><dt><code>.LIBPATTERNS</code>
<dd>Defines the naming of the libraries <code>make</code> searches for, and their
order.<br>
See <a href="Libraries-Search.html#Libraries%2fSearch">Directory Search for Link Libraries</a>.
</dl>
</body></html>