BSD 4_4 development
[unix-history] / usr / share / man / cat1 / make.0
CommitLineData
28b214ee
C
1MAKE(1) BSD Reference Manual MAKE(1)
2
3N\bNA\bAM\bME\bE
4 m\bma\bak\bke\be - maintain program dependencies
5
6S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
7 m\bma\bak\bke\be [-\b-e\bei\bik\bkn\bnq\bqr\brs\bst\btv\bv] [-\b-D\bD _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be] [-\b-d\bd _\bf_\bl_\ba_\bg_\bs] [-\b-f\bf _\bm_\ba_\bk_\be_\bf_\bi_\bl_\be] [-\b-I\bI _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by]
8 [-\b-j\bj _\bm_\ba_\bx_\b__\bj_\bo_\bb_\bs] [_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\b=_\bv_\ba_\bl_\bu_\be] [_\bt_\ba_\br_\bg_\be_\bt _\b._\b._\b.]
9
10D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
11 M\bMa\bak\bke\be is a program designed to simplify the maintenance of other programs.
12 Its input is a list of specifications as to the files upon which programs
13 and other files depend. If the file `_\bm_\ba_\bk_\be_\bf_\bi_\bl_\be' exists, it is read for
14 this list of specifications. If it does not exist, the file `_\bM_\ba_\bk_\be_\bf_\bi_\bl_\be'
15 is read. If the file `_\b._\bd_\be_\bp_\be_\bn_\bd' exists, it is read (see mkdep(1)).
16
17 This manual page is intended as a reference document only. For a more
18 thorough description of m\bma\bak\bke\be and makefiles, please refer to _\bM_\ba_\bk_\be _\b- _\bA
19 _\bT_\bu_\bt_\bo_\br_\bi_\ba_\bl.
20
21 The options are as follows:
22
23 -\b-D\bD _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
24 Define Ar variable to be 1, in the global context.
25
26 -\b-d\bd _\bf_\bl_\ba_\bg_\bs
27 Turn on debugging, and specify which portions of m\bma\bak\bke\be are to
28 print debugging information. _\bF_\bl_\ba_\bg_\bs is one or more of the follow-
29 ing:
30
31 _\bA Print all possible debugging information; equivalent to
32 specifying all of the debugging flags.
33
34 _\ba Print debugging information about archive searching and
35 caching.
36
37 _\bc Print debugging information about conditional evaluation.
38
39 _\bd Print debugging information about directory searching and
40 caching.
41
42 _\bg_\b1 Print the input graph before making anything.
43
44 _\bg_\b2 Print the input graph after making everything, or before
45 exiting on error.
46
47 _\bj Print debugging information about running multiple
48 shells.
49
50 _\bm Print debugging information about making targets, includ-
51 ing modification dates.
52
53 _\bs Print debugging information about suffix-transformation
54 rules.
55
56 _\bt Print debugging information about target list mainte-
57 nance.
58
59 _\bv Print debugging information about variable assignment.
60
61 -\b-e\be Specify that environmental variables override macro assignments
62 within makefiles.
63
64 -\b-f\bf _\bm_\ba_\bk_\be_\bf_\bi_\bl_\be
65 Specify a makefile to read instead of the default `_\bm_\ba_\bk_\be_\bf_\bi_\bl_\be' and
66 `_\bM_\ba_\bk_\be_\bf_\bi_\bl_\be'. If _\bm_\ba_\bk_\be_\bf_\bi_\bl_\be is `-\b-', standard input is read. Multiple
67 makefile's may be specified, and are read in the order specified.
68
69 -\b-I\bI _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by
70 Specify a directory in which to search for makefiles and included
71 makefiles. The system makefile directory is automatically in-
72 cluded as part of this list.
73
74 -\b-i\bi Ignore non-zero exit of shell commands in the makefile. Equiva-
75 lent to specifying `-\b-' before each command line in the makefile.
76
77 -\b-j\bj _\bm_\ba_\bx_\b__\bj_\bo_\bb_\bs
78 Specify the maximum number of jobs that m\bma\bak\bke\be may have running at
79 any one time.
80
81 -\b-k\bk Continue processing after errors are encountered, but only on
82 those targets that do not depend on the target whose creation
83 caused the error.
84
85 -\b-n\bn Display the commands that would have been executed, but do not
86 actually execute them.
87
88 -\b-q\bq Do not execute any commands, but exit 0 if the specified targets
89 are up-to-date and 1, otherwise.
90
91 -\b-r\br Do not use the built-in rules specified in the system makefile.
92
93 -\b-s\bs Do not echo any commands as they are executed. Equivalent to
94 specifying `@\b@' before each command line in the makefile.
95
96 -\b-t\bt Rather than re-building a target as specified in the makefile,
97 create it or update its modification time to make it appear up-
98 to-date.
99
100 _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\b=_\bv_\ba_\bl_\bu_\be
101 Set the value of the variable _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be to _\bv_\ba_\bl_\bu_\be.
102
103 There are seven different types of lines in a makefile: file dependency
104 specifications, shell commands, variable assignments, include statements,
105 conditional directives, for loops, and comments.
106
107 In general, lines may be continued from one line to the next by ending
108 them with a backslash (`\'). The trailing newline character and initial
109 whitespace on the following line are compressed into a single space.
110
111F\bFI\bIL\bLE\bE D\bDE\bEP\bPE\bEN\bND\bDE\bEN\bNC\bCY\bY S\bSP\bPE\bEC\bCI\bIF\bFI\bIC\bCA\bAT\bTI\bIO\bON\bNS\bS
112 Dependency lines consist of one or more targets, an operator, and zero or
113 more sources. This creates a relationship where the targets ``depend''
114 on the sources and are usually created from them. The exact relationship
115 between the target and the source is determined by the operator that sep-
116 arates them. The three operators are as follows:
117
118 :\b: A target is considered out-of-date if its modification time is less
119 than those of any of its sources. Sources for a target accumulate
120 over dependency lines when this operator is used. The target is
121 removed if m\bma\bak\bke\be is interrupted.
122
123 !\b! Targets are always re-created, but not until all sources have been
124 examined and re-created as necessary. Sources for a target accumu-
125 late over dependency lines when this operator is used. The target
126 is removed if m\bma\bak\bke\be is interrupted.
127
128 :\b::\b: If no sources are specified, the target is always re-created. Oth-
129 erwise, a target is considered out-of-date if any of its sources
130 has been modified more recently than the target. Sources for a
131 target do not accumulate over dependency lines when this operator
132 is used. The target will not be removed if m\bma\bak\bke\be is interrupted.
133
134 Targets and sources may contain the shell wildcard values `?', `*', `[]'
135 and `{}'. The values `?', `*' and `[]' may only be used as part of the
136 final component of the target or source, and must be used to describe ex-
137 isting files. The value `{}' need not necessarily be used to describe
138 existing files. Expansion is in directory order, not alphabetically as
139 done in the shell.
140
141S\bSH\bHE\bEL\bLL\bL C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
142 Each target may have associated with it a series of shell commands, nor-
143 mally used to create the target. Each of the commands in this script
144 _\bm_\bu_\bs_\bt be preceded by a tab. While any target may appear on a dependency
145 line, only one of these dependencies may be followed by a creation
146 script, unless the `:\b::\b:' operator is used.
147
148 If the first or first two characters of the command line are `@\b@' and/or
149 `-\b-', the command is treated specially. A `@\b@' causes the command not to
150 be echoed before it is executed. A `-\b-' causes any non-zero exit status
151 of the command line to be ignored.
152
153V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bE A\bAS\bSS\bSI\bIG\bGN\bNM\bME\bEN\bNT\bTS\bS
154 Variables in make are much like variables in the shell, and, by tradi-
155 tion, consist of all upper-case letters. The five operators that can be
156 used to assign values to variables are as follows:
157
158 =\b= Assign the value to the variable. Any previous value is overrid-
159 den.
160
161 +\b+=\b= Append the value to the current value of the variable.
162
163 ?\b?=\b= Assign the value to the variable if it is not already defined.
164
165 :\b:=\b= Assign with expansion, i.e. expand the value before assigning it
166 to the variable. Normally, expansion is not done until the vari-
167 able is referenced.
168
169 !\b!=\b= Expand the value and pass it to the shell for execution and as-
170 sign the result to the variable. Any newlines in the result are
171 replaced with spaces.
172
173 Any white-space before the assigned _\bv_\ba_\bl_\bu_\be is removed; if the value is be-
174 ing appended, a single space is inserted between the previous contents of
175 the variable and the appended value.
176
177 Variables are expanded by surrounding the variable name with either curly
178 braces (`{}') or parenthesis (`()') and preceding it with a dollar sign
179 (`$'). If the variable name contains only a single letter, the surround-
180 ing braces or parenthesis are not required. This shorter form is not
181 recommended.
182
183 Variable substitution occurs at two distinct times, depending on where
184 the variable is being used. Variables in dependency lines are expanded
185 as the line is read. Variables in shell commands are expanded when the
186 shell command is executed.
187
188 The four different classes of variables (in order of increasing prece-
189 dence) are:
190
191 Environment variables
192 Variables defined as part of m\bma\bak\bke\be's environment.
193
194 Global variables
195 Variables defined in the makefile or in included makefiles.
196
197 Command line variables
198
199 Variables defined as part of the command line.
200
201 Local variables
202 Variables that are defined specific to a certain target. The
203 seven local variables are as follows:
204
205 _\b._\bA_\bL_\bL_\bS_\bR_\bC The list of all sources for this target; also known as
206 `_\b>'.
207
208 _\b._\bA_\bR_\bC_\bH_\bI_\bV_\bE The name of the archive file.
209
210 _\b._\bI_\bM_\bP_\bS_\bR_\bC The name/path of the source from which the target is to
211 be transformed (the ``implied'' source); also known as
212 `_\b<'.
213
214 _\b._\bM_\bE_\bM_\bB_\bE_\bR The name of the archive member.
215
216 _\b._\bO_\bO_\bD_\bA_\bT_\bE The list of sources for this target that were deemed
217 out-of-date; also known as `_\b?'.
218
219 _\b._\bP_\bR_\bE_\bF_\bI_\bX The file prefix of the file, containing only the file
220 portion, no suffix or preceding directory components;
221 also known as `_\b*'.
222
223 _\b._\bT_\bA_\bR_\bG_\bE_\bT The name of the target; also known as `_\b@'.
224
225 The shorter forms `_\b@', `_\b?', `_\b>' and `_\b*' are permitted for back-
226 ward compatibility with historical makefiles and are not recom-
227 mended. The six variables `_\b@_\bF', `_\b@_\bD', `_\b<_\bF', `_\b<_\bD', `_\b*_\bF' and `_\b*_\bD'
228 are permitted for compatibility with AT&T System V UNIX makefiles
229 and are not recommended.
230
231 Four of the local variables may be used in sources on dependency
232 lines because they expand to the proper value for each target on
233 the line. These variables are `_\b._\bT_\bA_\bR_\bG_\bE_\bT', `_\b._\bP_\bR_\bE_\bF_\bI_\bX', `_\b._\bA_\bR_\bC_\bH_\bI_\bV_\bE',
234 and `_\b._\bM_\bE_\bM_\bB_\bE_\bR'.
235
236 In addition, m\bma\bak\bke\be sets or knows about the following variables:
237
238 _\b$ A single dollar sign `$', i.e. `$$' expands to a sin-
239 gle dollar sign.
240
241 _\b._\bM_\bA_\bK_\bE The name that m\bma\bak\bke\be was executed with (_\ba_\br_\bg_\bv [0])
242
243 _\b._\bC_\bU_\bR_\bD_\bI_\bR A path to the directory where m\bma\bak\bke\be was executed.
244
245 MAKEFLAGS The environment variable `MAKEFLAGS' may contain any-
246 thing that may be specified on m\bma\bak\bke\be's command line.
247 Anything specified on m\bma\bak\bke\be's command line is appended
248 to the `MAKEFLAGS' variable which is then entered into
249 the environment for all programs which m\bma\bak\bke\be executes.
250
251 Variable expansion may be modified to select or modify each word
252 of the variable (where a ``word'' is white-space delimited se-
253 quence of characters). The general format of a variable expan-
254 sion is as follows:
255
256 {variable[:modifier[:...]]}
257
258 Each modifier begins with a colon and one of the following spe-
259 cial characters. The colon may be escaped with a backslash
260 (`\').
261
262
263
264 E\bE Replaces each word in the variable with its suffix.
265
266 H\bH Replaces each word in the variable with everything
267 but the last component.
268
269 M\bM_\bp_\ba_\bt_\bt_\be_\br_\bn Select only those words that match the rest of the
270 modifier. The standard shell wildcard characters
271 (`*', `?', and `[]') may be used. The wildcard char-
272 acters may be escaped with a backslash (`\').
273
274 N\bN_\bp_\ba_\bt_\bt_\be_\br_\bn This is identical to `M\bM', but selects all words which
275 do not match the rest of the modifier.
276
277 R\bR Replaces each word in the variable with everything
278 but its suffix.
279
280 S\bS/_\bo_\bl_\bd_\b__\bp_\ba_\bt_\bt_\be_\br_\bn/_\bn_\be_\bw_\b__\bp_\ba_\bt_\bt_\be_\br_\bn/[g\bg]
281 Modify the first occurrence of _\bo_\bl_\bd_\b__\bp_\ba_\bt_\bt_\be_\br_\bn in each
282 word to be replaced with _\bn_\be_\bw_\b__\bp_\ba_\bt_\bt_\be_\br_\bn. If a `g' is ap-
283 pended to the last slash of the pattern, all occur-
284 rences in each word are replaced. If _\bo_\bl_\bd_\b__\bp_\ba_\bt_\bt_\be_\br_\bn be-
285 gins with a carat (`^'), _\bo_\bl_\bd_\b__\bp_\ba_\bt_\bt_\be_\br_\bn is anchored at
286 the beginning of each word. If _\bo_\bl_\bd_\b__\bp_\ba_\bt_\bt_\be_\br_\bn ends with
287 a dollar sign (`$'), it is anchored at the end of
288 each word. Inside _\bn_\be_\bw_\b__\bs_\bt_\br_\bi_\bn_\bg, an ampersand (`&') is
289 replaced by _\bo_\bl_\bd_\b__\bp_\ba_\bt_\bt_\be_\br_\bn. Any character may be used as
290 a delimiter for the parts of the modifier string.
291 The anchoring, ampersand and delimiter characters may
292 be escaped with a backslash (`\').
293
294 Variable expansion occurs in the normal fashion in-
295 side both _\bo_\bl_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg and _\bn_\be_\bw_\b__\bs_\bt_\br_\bi_\bn_\bg with the single
296 exception that a backslash is used to prevent the ex-
297 pansion of a dollar sign (`$') not a preceding dollar
298 sign as is usual.
299
300 T\bT Replaces each word in the variable with its last com-
301 ponent.
302
303 _\bo_\bl_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg_\b=_\bn_\be_\bw_\b__\bs_\bt_\br_\bi_\bn_\bg
304 This is the AT&T System V UNIX style variable substi-
305 tution. It must be the last modifier specified.
306 _\bO_\bl_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg is anchored at the end of each word, so
307 only suffixes or entire words may be replaced.
308
309I\bIN\bNC\bCL\bLU\bUD\bDE\bE S\bST\bTA\bAT\bTE\bEM\bME\bEN\bNT\bTS\bS,\b, C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bLS\bS A\bAN\bND\bD F\bFO\bOR\bR L\bLO\bOO\bOP\bPS\bS
310 Makefile inclusion, conditional structures and for loops reminiscent of
311 the C programming language are provided in m\bma\bak\bke\be. All such structures are
312 identified by a line beginning with a single dot (`.') character. Files
313 are included with either `.include <file>' or `.include "file"'. Vari-
314 ables between the angle brackets or double quotes are expanded to form
315 the file name. If angle brackets are used, the included makefile is ex-
316 pected to be in the system makefile directory. If double quotes are
317 used, the including makefile's directory and any directories specified
318 using the -\b-I\bI option are searched before the system makefile directory.
319
320 Conditional expressions are also preceded by a single dot as the first
321 chraracter of a line. The possible conditionals are as follows:
322
323 .\b.u\bun\bnd\bde\bef\bf _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
324 Un-define the specified global variable. Only global variables
325 may be un-defined.
326
327 .\b.i\bif\bf [!]_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn _\b._\b._\b.]
328
329
330 Test the value of an expression.
331
332 .\b.i\bif\bfd\bde\bef\bf [!]_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\b._\b._\b.]
333 Test the value of an variable.
334
335 .\b.i\bif\bfn\bnd\bde\bef\bf [!]_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\b._\b._\b.]
336 Test the value of an variable.
337
338 .\b.i\bif\bfm\bma\bak\bke\be [!]_\bt_\ba_\br_\bg_\be_\bt [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bt_\ba_\br_\bg_\be_\bt _\b._\b._\b.]
339 Test the the target being built.
340
341 .\b.i\bif\bfn\bnm\bma\bak\bke\be [!]_\bt_\ba_\br_\bg_\be_\bt [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bt_\ba_\br_\bg_\be_\bt _\b._\b._\b.]
342 Test the target being built.
343
344 .\b.e\bel\bls\bse\be Reverse the sense of the last conditional.
345
346 .\b.e\bel\bli\bif\bf [!]_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn _\b._\b._\b.]
347 A combination of `.\b.e\bel\bls\bse\be' followed by `.\b.i\bif\bf'.
348
349 .\b.e\bel\bli\bif\bfd\bde\bef\bf [!]_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\b._\b._\b.]
350 A combination of `.\b.e\bel\bls\bse\be' followed by `.\b.i\bif\bfd\bde\bef\bf'.
351
352 .\b.e\bel\bli\bif\bfn\bnd\bde\bef\bf [!]_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\b._\b._\b.]
353 A combination of `.\b.e\bel\bls\bse\be' followed by `.\b.i\bif\bfn\bnd\bde\bef\bf'.
354
355 .\b.e\bel\bli\bif\bfm\bma\bak\bke\be [!]_\bt_\ba_\br_\bg_\be_\bt [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bt_\ba_\br_\bg_\be_\bt _\b._\b._\b.]
356 A combination of `.\b.e\bel\bls\bse\be' followed by `.\b.i\bif\bfm\bma\bak\bke\be'.
357
358 .\b.e\bel\bli\bif\bfn\bnm\bma\bak\bke\be [!]_\bt_\ba_\br_\bg_\be_\bt [_\bo_\bp_\be_\br_\ba_\bt_\bo_\br _\bt_\ba_\br_\bg_\be_\bt _\b._\b._\b.]
359 A combination of `.\b.e\bel\bls\bse\be' followed by `.\b.i\bif\bfn\bnm\bma\bak\bke\be'.
360
361 .\b.e\ben\bnd\bdi\bif\bf End the body of the conditional.
362
363 The _\bo_\bp_\be_\br_\ba_\bt_\bo_\br may be any one of the following:
364
365 |\b||\b| logical OR
366
367 &\b&&\b& Logical AND; of higher precedence than ``''.
368
369 As in C, m\bma\bak\bke\be will only evaluate a conditional as far as is necessary to
370 determine its value. Parenthesis may be used to change the order of
371 evaluation. The boolean operator `!\b!' may be used to logically negate an
372 entire conditional. It is of higher precendence than `&\b&&\b&'.
373
374 The value of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn may be any of the following:
375
376 d\bde\bef\bfi\bin\bne\bed\bd Takes a variable name as an argument and evaluates to true if
377 the variable has been defined.
378
379 m\bma\bak\bke\be Takes a target name as an argument and evaluates to true if
380 the target was specified as part of m\bma\bak\bke\be's command line or
381 was declared the default target (either implicitly or explic-
382 itly, see _\b._\bM_\bA_\bI_\bN) before the line containing the conditional.
383
384 e\bem\bmp\bpt\bty\by Takes a variable, with possible modifiers, and evalutes to
385 true if the expansion of the variable would result in an emp-
386 ty string.
387
388 e\bex\bxi\bis\bst\bts\bs Takes a file name as an argument and evaluates to true if the
389 file exists. The file is searched for on the system search
390 path (see _\b._\bP_\bA_\bT_\bH).
391
392 t\bta\bar\brg\bge\bet\bt Takes a target name as an argument and evaluates to true if
393 the target has been defined.
394
395
396 _\bE_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn may also be an arithmetic or string comparison. Variable ex-
397 pansion is performed on both sides of the comparison, after which the in-
398 tegral values are compared. A value is interpreted as hexadecimal if it
399 is preceded by 0x, otherwise it is decimal; octal numbers are not sup-
400 ported. The standard C relational operators are all supported. If after
401 variable expansion, either the left or right hand side of a `=\b==\b=' or `!\b!=\b='
402 operator is not an integral value, then string comparison is performed
403 between the expanded variables. If no relational operator is given, it
404 is assumed that the expanded variable is being compared against 0.
405
406 When m\bma\bak\bke\be is evaluating one of these conditional expression, and it en-
407 counters a word it doesn't recognize, either the ``make'' or ``defined''
408 expression is applied to it, depending on the form of the conditional.
409 If the form is `.\b.i\bif\bfd\bde\bef\bf' or `.\b.i\bif\bfn\bnd\bde\bef\bf', the ``defined'' expression is ap-
410 plied. Similarly, if the form is `.\b.i\bif\bfm\bma\bak\bke\be' or `.\b.i\bif\bfn\bnm\bma\bak\bke\be, t\bth\bhe\be `\b``\b`m\bma\bak\bke\be'\b''\b''
411 expression is applied.
412
413 If the conditional evaluates to true the parsing of the makefile contin-
414 ues as before. If it evaluates to false, the following lines are
415 skipped. In both cases this continues until a `.\b.e\bel\bls\bse\be' or `.\b.e\ben\bnd\bdi\bif\bf' is
416 found.
417
418 For loops are typically used to apply a set of rules to a list of files.
419 The syntax of a for loop is:
420
421 .\b.f\bfo\bor\br _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be i\bin\bn _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
422 <make-rules>
423
424
425
426 .\b.e\ben\bnd\bdf\bfo\bor\br
427 After the for e\bex\bxp\bpr\bre\bes\bss\bsi\bio\bon\bn is evaluated, it is split into words. The itera-
428 tion v\bva\bar\bri\bia\bab\bbl\ble\be is successively set to each word, and substituted in the
429 m\bma\bak\bke\be-\b-r\bru\bul\ble\bes\bs inside the body of the for loop.
430
431C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS
432 Comments begin with a hash (`#') character, anywhere but in a shell com-
433 mand line, and continue to the end of the line.
434
435S\bSP\bPE\bEC\bCI\bIA\bAL\bL S\bSO\bOU\bUR\bRC\bCE\bES\bS
436 .\b.I\bIG\bGN\bNO\bOR\bRE\bE Ignore any errors from the commands associated with this tar-
437 get, exactly as if they all were preceded by a dash (`-').
438
439 .\b.M\bMA\bAK\bKE\bE Execute the commands associated with this target even if the
440 -\b-n\bn or -\b-t\bt options were specified. Normally used to mark re-
441 cursive m\bma\bak\bke\be's.
442
443 .\b.N\bNO\bOT\bTM\bMA\bAI\bIN\bN Normally m\bma\bak\bke\be selects the first target it encounters as the
444 default target to be built if no target was specified. This
445 source prevents this target from being selected.
446
447 .\b.O\bOP\bPT\bTI\bIO\bON\bNA\bAL\bL If a target is marked with this attribute and m\bma\bak\bke\be can't fig-
448 ure out how to create it, it will ignore this fact and assume
449 the file isn't needed or already exists.
450
451 .\b.P\bPR\bRE\bEC\bCI\bIO\bOU\bUS\bS When m\bma\bak\bke\be is interrupted, it removes any partially made tar-
452 gets. This source prevents the target from being removed.
453
454 .\b.S\bSI\bIL\bLE\bEN\bNT\bT Do not echo any of the commands associated with this target,
455 exactly as if they all were preceded by an at sign (`@').
456
457 .\b.U\bUS\bSE\bE Turn the target into m\bma\bak\bke\be's. version of a macro. When the
458 target is used as a source for another target, the other tar-
459 get acquires the commands, sources, and attributes (except
460 for .\b.U\bUS\bSE\bE) of the source. If the target already has commands,
461 the .\b.U\bUS\bSE\bE target's commands are appended to them.
462
463S\bSP\bPE\bEC\bCI\bIA\bAL\bL T\bTA\bAR\bRG\bGE\bET\bTS\bS
464 Special targets may not be included with other targets, i.e. they must be
465 the only target specified.
466
467 .\b.B\bBE\bEG\bGI\bIN\bN Any command lines attached to this target are executed before
468 anything else is done.
469
470 .\b.D\bDE\bEF\bFA\bAU\bUL\bLT\bT This is sort of a .\b.U\bUS\bSE\bE rule for any target (that was used on-
471 ly as a source) that m\bma\bak\bke\be can't figure out any other way to
472 create. Only the shell script is used. The .\b.I\bIM\bMP\bPS\bSR\bRC\bC variable
473 of a target that inherits .\b.D\bDE\bEF\bFA\bAU\bUL\bLT\bT's commands is set to the
474 target's own name.
475
476 .\b.E\bEN\bND\bD Any command lines attached to this target are executed after
477 everything else is done.
478
479 .\b.I\bIG\bGN\bNO\bOR\bRE\bE Mark each of the sources with the .\b.I\bIG\bGN\bNO\bOR\bRE\bE attribute. If no
480 sources are specified, this is the equivalent of specifying
481 the -\b-i\bi option.
482
483 .\b.I\bIN\bNT\bTE\bER\bRR\bRU\bUP\bPT\bT If m\bma\bak\bke\be is interrupted, the commands for this target will be
484 executed.
485
486 .\b.M\bMA\bAI\bIN\bN If no target is specified when m\bma\bak\bke\be is invoked, this target
487 will be built.
488
489 .\b.M\bMA\bAK\bKE\bEF\bFL\bLA\bAG\bGS\bS This target provides a way to specify flags for m\bma\bak\bke\be when the
490 makefile is used. The flags are as if typed to the shell,
491 though the -\b-f\bf option will have no effect.
492
493 .\b.P\bPA\bAT\bTH\bH The sources are directories which are to be searched for
494 files not found in the current directory. If no sources are
495 specified, any previously specified directories are deleted.
496
497 .\b.P\bPR\bRE\bEC\bCI\bIO\bOU\bUS\bS Apply the .\b.P\bPR\bRE\bEC\bCI\bIO\bOU\bUS\bS attribute to any specified sources. If
498 no sources are specified, the .\b.P\bPR\bRE\bEC\bCI\bIO\bOU\bUS\bS attribute is applied
499 to every target in the file.
500
501 .\b.S\bSI\bIL\bLE\bEN\bNT\bT Apply the .\b.S\bSI\bIL\bLE\bEN\bNT\bT attribute to any specified sources. If no
502 sources are specified, the .\b.S\bSI\bIL\bLE\bEN\bNT\bT attribute is applied to
503 every command in the file.
504
505 .\b.S\bSU\bUF\bFF\bFI\bIX\bXE\bES\bS Each source specifies a suffix to m\bma\bak\bke\be. If no sources are
506 specified, any previous specifies suffices are deleted.
507
508E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT
509 M\bMa\bak\bke\be utilizes the following environment variables, if they exist: MAKE,
510 MAKEFLAGS and MAKEOBJDIR.
511
512F\bFI\bIL\bLE\bES\bS
513 .depend list of dependencies
514 Makefile list of dependencies
515 makefile list of dependencies
516 sys.mk system makefile
517 /usr/share/mk system makefile directory
518
519S\bSE\bEE\bE A\bAL\bLS\bSO\bO
520 mkdep(1)
521
522H\bHI\bIS\bST\bTO\bOR\bRY\bY
523 A M\bMa\bak\bke\be command appeared in Version 7 AT&T UNIX.
524
5254.4BSD June 6, 1993 8