Sat Dec 17 04:43:45 2011 UTC ()
The :@ example gives the impression that we encourage the ODE
convention of naming loop variables like .LINK., when in fact
single char variables are far more common in NetBSD.


(sjg)
diff -r1.197 -r1.198 src/usr.bin/make/make.1

cvs diff -r1.197 -r1.198 src/usr.bin/make/make.1 (switch to unified diff)

--- src/usr.bin/make/make.1 2011/11/13 18:18:35 1.197
+++ src/usr.bin/make/make.1 2011/12/17 04:43:45 1.198
@@ -1,2069 +1,2072 @@ @@ -1,2069 +1,2072 @@
1.\" $NetBSD: make.1,v 1.197 2011/11/13 18:18:35 dholland Exp $ 1.\" $NetBSD: make.1,v 1.198 2011/12/17 04:43:45 sjg Exp $
2.\" 2.\"
3.\" Copyright (c) 1990, 1993 3.\" Copyright (c) 1990, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors 14.\" 3. Neither the name of the University nor the names of its contributors
15.\" may be used to endorse or promote products derived from this software 15.\" may be used to endorse or promote products derived from this software
16.\" without specific prior written permission. 16.\" without specific prior written permission.
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 30.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
31.\" 31.\"
32.Dd November 6, 2011 32.Dd December 16, 2011
33.Dt MAKE 1 33.Dt MAKE 1
34.Os 34.Os
35.Sh NAME 35.Sh NAME
36.Nm make 36.Nm make
37.Nd maintain program dependencies 37.Nd maintain program dependencies
38.Sh SYNOPSIS 38.Sh SYNOPSIS
39.Nm 39.Nm
40.Op Fl BeikNnqrstWX 40.Op Fl BeikNnqrstWX
41.Bk -words 41.Bk -words
42.Op Fl C Ar directory 42.Op Fl C Ar directory
43.Ek 43.Ek
44.Bk -words 44.Bk -words
45.Op Fl D Ar variable 45.Op Fl D Ar variable
46.Ek 46.Ek
47.Bk -words 47.Bk -words
48.Op Fl d Ar flags 48.Op Fl d Ar flags
49.Ek 49.Ek
50.Bk -words 50.Bk -words
51.Op Fl f Ar makefile 51.Op Fl f Ar makefile
52.Ek 52.Ek
53.Bk -words 53.Bk -words
54.Op Fl I Ar directory 54.Op Fl I Ar directory
55.Ek 55.Ek
56.Bk -words 56.Bk -words
57.Op Fl J Ar private 57.Op Fl J Ar private
58.Ek 58.Ek
59.Bk -words 59.Bk -words
60.Op Fl j Ar max_jobs 60.Op Fl j Ar max_jobs
61.Ek 61.Ek
62.Bk -words 62.Bk -words
63.Op Fl m Ar directory 63.Op Fl m Ar directory
64.Ek 64.Ek
65.Bk -words 65.Bk -words
66.Op Fl T Ar file 66.Op Fl T Ar file
67.Ek 67.Ek
68.Bk -words 68.Bk -words
69.Op Fl V Ar variable 69.Op Fl V Ar variable
70.Ek 70.Ek
71.Op Ar variable=value 71.Op Ar variable=value
72.Bk -words 72.Bk -words
73.Op Ar target ... 73.Op Ar target ...
74.Ek 74.Ek
75.Sh DESCRIPTION 75.Sh DESCRIPTION
76.Nm 76.Nm
77is a program designed to simplify the maintenance of other programs. 77is a program designed to simplify the maintenance of other programs.
78Its input is a list of specifications as to the files upon which programs 78Its input is a list of specifications as to the files upon which programs
79and other files depend. 79and other files depend.
80If no 80If no
81.Fl f Ar makefile 81.Fl f Ar makefile
82makefile option is given, 82makefile option is given,
83.Nm 83.Nm
84will try to open 84will try to open
85.Ql Pa makefile 85.Ql Pa makefile
86then 86then
87.Ql Pa Makefile 87.Ql Pa Makefile
88in order to find the specifications. 88in order to find the specifications.
89If the file 89If the file
90.Ql Pa .depend 90.Ql Pa .depend
91exists, it is read (see 91exists, it is read (see
92.Xr mkdep 1 ) . 92.Xr mkdep 1 ) .
93.Pp 93.Pp
94This manual page is intended as a reference document only. 94This manual page is intended as a reference document only.
95For a more thorough description of 95For a more thorough description of
96.Nm 96.Nm
97and makefiles, please refer to 97and makefiles, please refer to
98.%T "PMake \- A Tutorial" . 98.%T "PMake \- A Tutorial" .
99.Pp 99.Pp
100.Nm 100.Nm
101will prepend the contents of the 101will prepend the contents of the
102.Va MAKEFLAGS 102.Va MAKEFLAGS
103environment variable to the command line arguments before parsing them. 103environment variable to the command line arguments before parsing them.
104.Pp 104.Pp
105The options are as follows: 105The options are as follows:
106.Bl -tag -width Ds 106.Bl -tag -width Ds
107.It Fl B 107.It Fl B
108Try to be backwards compatible by executing a single shell per command and 108Try to be backwards compatible by executing a single shell per command and
109by executing the commands to make the sources of a dependency line in sequence. 109by executing the commands to make the sources of a dependency line in sequence.
110.It Fl C Ar directory 110.It Fl C Ar directory
111Change to 111Change to
112.Ar directory 112.Ar directory
113before reading the makefiles or doing anything else. 113before reading the makefiles or doing anything else.
114If multiple 114If multiple
115.Fl C 115.Fl C
116options are specified, each is interpreted relative to the previous one: 116options are specified, each is interpreted relative to the previous one:
117.Fl C Pa / Fl C Pa etc 117.Fl C Pa / Fl C Pa etc
118is equivalent to 118is equivalent to
119.Fl C Pa /etc . 119.Fl C Pa /etc .
120.It Fl D Ar variable 120.It Fl D Ar variable
121Define 121Define
122.Ar variable 122.Ar variable
123to be 1, in the global context. 123to be 1, in the global context.
124.It Fl d Ar [-]flags 124.It Fl d Ar [-]flags
125Turn on debugging, and specify which portions of 125Turn on debugging, and specify which portions of
126.Nm 126.Nm
127are to print debugging information. 127are to print debugging information.
128Unless the flags are preceded by 128Unless the flags are preceded by
129.Ql \- 129.Ql \-
130they are added to the 130they are added to the
131.Va MAKEFLAGS 131.Va MAKEFLAGS
132environment variable and will be processed by any child make processes. 132environment variable and will be processed by any child make processes.
133By default, debugging information is printed to standard error, 133By default, debugging information is printed to standard error,
134but this can be changed using the 134but this can be changed using the
135.Ar F 135.Ar F
136debugging flag. 136debugging flag.
137The debugging output is always unbuffered; in addition, if debugging 137The debugging output is always unbuffered; in addition, if debugging
138is enabled but debugging output is not directed to standard output, 138is enabled but debugging output is not directed to standard output,
139then the standard output is line buffered. 139then the standard output is line buffered.
140.Ar Flags 140.Ar Flags
141is one or more of the following: 141is one or more of the following:
142.Bl -tag -width Ds 142.Bl -tag -width Ds
143.It Ar A 143.It Ar A
144Print all possible debugging information; 144Print all possible debugging information;
145equivalent to specifying all of the debugging flags. 145equivalent to specifying all of the debugging flags.
146.It Ar a 146.It Ar a
147Print debugging information about archive searching and caching. 147Print debugging information about archive searching and caching.
148.It Ar C 148.It Ar C
149Print debugging information about current working directory. 149Print debugging information about current working directory.
150.It Ar c 150.It Ar c
151Print debugging information about conditional evaluation. 151Print debugging information about conditional evaluation.
152.It Ar d 152.It Ar d
153Print debugging information about directory searching and caching. 153Print debugging information about directory searching and caching.
154.It Ar e 154.It Ar e
155Print debugging information about failed commands and targets. 155Print debugging information about failed commands and targets.
156.It Ar F Ns Oo Sy \&+ Oc Ns Ar filename 156.It Ar F Ns Oo Sy \&+ Oc Ns Ar filename
157Specify where debugging output is written. 157Specify where debugging output is written.
158This must be the last flag, because it consumes the remainder of 158This must be the last flag, because it consumes the remainder of
159the argument. 159the argument.
160If the character immediately after the 160If the character immediately after the
161.Ql F 161.Ql F
162flag is 162flag is
163.Ql \&+ , 163.Ql \&+ ,
164then the file will be opened in append mode; 164then the file will be opened in append mode;
165otherwise the file will be overwritten. 165otherwise the file will be overwritten.
166If the file name is 166If the file name is
167.Ql stdout 167.Ql stdout
168or 168or
169.Ql stderr 169.Ql stderr
170then debugging output will be written to the 170then debugging output will be written to the
171standard output or standard error output file descriptors respectively 171standard output or standard error output file descriptors respectively
172(and the 172(and the
173.Ql \&+ 173.Ql \&+
174option has no effect). 174option has no effect).
175Otherwise, the output will be written to the named file. 175Otherwise, the output will be written to the named file.
176If the file name ends 176If the file name ends
177.Ql .%d 177.Ql .%d
178then the 178then the
179.Ql %d 179.Ql %d
180is replaced by the pid. 180is replaced by the pid.
181.It Ar f 181.It Ar f
182Print debugging information about loop evaluation. 182Print debugging information about loop evaluation.
183.It Ar "g1" 183.It Ar "g1"
184Print the input graph before making anything. 184Print the input graph before making anything.
185.It Ar "g2" 185.It Ar "g2"
186Print the input graph after making everything, or before exiting 186Print the input graph after making everything, or before exiting
187on error. 187on error.
188.It Ar "g3" 188.It Ar "g3"
189Print the input graph before exiting on error. 189Print the input graph before exiting on error.
190.It Ar j 190.It Ar j
191Print debugging information about running multiple shells. 191Print debugging information about running multiple shells.
192.It Ar l 192.It Ar l
193Print commands in Makefiles regardless of whether or not they are prefixed by 193Print commands in Makefiles regardless of whether or not they are prefixed by
194.Ql @ 194.Ql @
195or other "quiet" flags. 195or other "quiet" flags.
196Also known as "loud" behavior. 196Also known as "loud" behavior.
197.It Ar M 197.It Ar M
198Print debugging information about "meta" mode decisions about targets. 198Print debugging information about "meta" mode decisions about targets.
199.It Ar m 199.It Ar m
200Print debugging information about making targets, including modification 200Print debugging information about making targets, including modification
201dates. 201dates.
202.It Ar n 202.It Ar n
203Don't delete the temporary command scripts created when running commands. 203Don't delete the temporary command scripts created when running commands.
204These temporary scripts are created in the directory 204These temporary scripts are created in the directory
205referred to by the 205referred to by the
206.Ev TMPDIR 206.Ev TMPDIR
207environment variable, or in 207environment variable, or in
208.Pa /tmp 208.Pa /tmp
209if 209if
210.Ev TMPDIR 210.Ev TMPDIR
211is unset or set to the empty string. 211is unset or set to the empty string.
212The temporary scripts are created by 212The temporary scripts are created by
213.Xr mkstemp 3 , 213.Xr mkstemp 3 ,
214and have names of the form 214and have names of the form
215.Pa makeXXXXXX . 215.Pa makeXXXXXX .
216.Em NOTE : 216.Em NOTE :
217This can create many files in 217This can create many files in
218.Ev TMPDIR 218.Ev TMPDIR
219or 219or
220.Pa /tmp , 220.Pa /tmp ,
221so use with care. 221so use with care.
222.It Ar p 222.It Ar p
223Print debugging information about makefile parsing. 223Print debugging information about makefile parsing.
224.It Ar s 224.It Ar s
225Print debugging information about suffix-transformation rules. 225Print debugging information about suffix-transformation rules.
226.It Ar t 226.It Ar t
227Print debugging information about target list maintenance. 227Print debugging information about target list maintenance.
228.It Ar v 228.It Ar v
229Print debugging information about variable assignment. 229Print debugging information about variable assignment.
230.It Ar x 230.It Ar x
231Run shell commands with 231Run shell commands with
232.Fl x 232.Fl x
233so the actual commands are printed as they are executed. 233so the actual commands are printed as they are executed.
234.El 234.El
235.It Fl e 235.It Fl e
236Specify that environment variables override macro assignments within 236Specify that environment variables override macro assignments within
237makefiles. 237makefiles.
238.It Fl f Ar makefile 238.It Fl f Ar makefile
239Specify a makefile to read instead of the default 239Specify a makefile to read instead of the default
240.Ql Pa makefile . 240.Ql Pa makefile .
241If 241If
242.Ar makefile 242.Ar makefile
243is 243is
244.Ql Fl , 244.Ql Fl ,
245standard input is read. 245standard input is read.
246Multiple makefiles may be specified, and are read in the order specified. 246Multiple makefiles may be specified, and are read in the order specified.
247.It Fl I Ar directory 247.It Fl I Ar directory
248Specify a directory in which to search for makefiles and included makefiles. 248Specify a directory in which to search for makefiles and included makefiles.
249The system makefile directory (or directories, see the 249The system makefile directory (or directories, see the
250.Fl m 250.Fl m
251option) is automatically included as part of this list. 251option) is automatically included as part of this list.
252.It Fl i 252.It Fl i
253Ignore non-zero exit of shell commands in the makefile. 253Ignore non-zero exit of shell commands in the makefile.
254Equivalent to specifying 254Equivalent to specifying
255.Ql Fl 255.Ql Fl
256before each command line in the makefile. 256before each command line in the makefile.
257.It Fl J Ar private 257.It Fl J Ar private
258This option should 258This option should
259.Em not 259.Em not
260be specified by the user. 260be specified by the user.
261.Pp 261.Pp
262When the 262When the
263.Ar j 263.Ar j
264option is in use in a recursive build, this option is passed by a make 264option is in use in a recursive build, this option is passed by a make
265to child makes to allow all the make processes in the build to 265to child makes to allow all the make processes in the build to
266cooperate to avoid overloading the system. 266cooperate to avoid overloading the system.
267.It Fl j Ar max_jobs 267.It Fl j Ar max_jobs
268Specify the maximum number of jobs that 268Specify the maximum number of jobs that
269.Nm 269.Nm
270may have running at any one time. 270may have running at any one time.
271The value is saved in 271The value is saved in
272.Va .MAKE.JOBS . 272.Va .MAKE.JOBS .
273Turns compatibility mode off, unless the 273Turns compatibility mode off, unless the
274.Ar B 274.Ar B
275flag is also specified. 275flag is also specified.
276When compatibility mode is off, all commands associated with a 276When compatibility mode is off, all commands associated with a
277target are executed in a single shell invocation as opposed to the 277target are executed in a single shell invocation as opposed to the
278traditional one shell invocation per line. 278traditional one shell invocation per line.
279This can break traditional scripts which change directories on each 279This can break traditional scripts which change directories on each
280command invocation and then expect to start with a fresh environment 280command invocation and then expect to start with a fresh environment
281on the next line. 281on the next line.
282It is more efficient to correct the scripts rather than turn backwards 282It is more efficient to correct the scripts rather than turn backwards
283compatibility on. 283compatibility on.
284.It Fl k 284.It Fl k
285Continue processing after errors are encountered, but only on those targets 285Continue processing after errors are encountered, but only on those targets
286that do not depend on the target whose creation caused the error. 286that do not depend on the target whose creation caused the error.
287.It Fl m Ar directory 287.It Fl m Ar directory
288Specify a directory in which to search for sys.mk and makefiles included 288Specify a directory in which to search for sys.mk and makefiles included
289via the 289via the
290.Ao Ar file Ac Ns -style 290.Ao Ar file Ac Ns -style
291include statement. 291include statement.
292The 292The
293.Fl m 293.Fl m
294option can be used multiple times to form a search path. 294option can be used multiple times to form a search path.
295This path will override the default system include path: /usr/share/mk. 295This path will override the default system include path: /usr/share/mk.
296Furthermore the system include path will be appended to the search path used 296Furthermore the system include path will be appended to the search path used
297for 297for
298.Qo Ar file Qc Ns -style 298.Qo Ar file Qc Ns -style
299include statements (see the 299include statements (see the
300.Fl I 300.Fl I
301option). 301option).
302.Pp 302.Pp
303If a file or directory name in the 303If a file or directory name in the
304.Fl m 304.Fl m
305argument (or the 305argument (or the
306.Ev MAKESYSPATH 306.Ev MAKESYSPATH
307environment variable) starts with the string 307environment variable) starts with the string
308.Qq \&.../ 308.Qq \&.../
309then 309then
310.Nm 310.Nm
311will search for the specified file or directory named in the remaining part 311will search for the specified file or directory named in the remaining part
312of the argument string. 312of the argument string.
313The search starts with the current directory of 313The search starts with the current directory of
314the Makefile and then works upward towards the root of the filesystem. 314the Makefile and then works upward towards the root of the filesystem.
315If the search is successful, then the resulting directory replaces the 315If the search is successful, then the resulting directory replaces the
316.Qq \&.../ 316.Qq \&.../
317specification in the 317specification in the
318.Fl m 318.Fl m
319argument. 319argument.
320If used, this feature allows 320If used, this feature allows
321.Nm 321.Nm
322to easily search in the current source tree for customized sys.mk files 322to easily search in the current source tree for customized sys.mk files
323(e.g., by using 323(e.g., by using
324.Qq \&.../mk/sys.mk 324.Qq \&.../mk/sys.mk
325as an argument). 325as an argument).
326.It Fl n 326.It Fl n
327Display the commands that would have been executed, but do not 327Display the commands that would have been executed, but do not
328actually execute them unless the target depends on the .MAKE special 328actually execute them unless the target depends on the .MAKE special
329source (see below). 329source (see below).
330.It Fl N 330.It Fl N
331Display the commands which would have been executed, but do not 331Display the commands which would have been executed, but do not
332actually execute any of them; useful for debugging top-level makefiles 332actually execute any of them; useful for debugging top-level makefiles
333without descending into subdirectories. 333without descending into subdirectories.
334.It Fl q 334.It Fl q
335Do not execute any commands, but exit 0 if the specified targets are 335Do not execute any commands, but exit 0 if the specified targets are
336up-to-date and 1, otherwise. 336up-to-date and 1, otherwise.
337.It Fl r 337.It Fl r
338Do not use the built-in rules specified in the system makefile. 338Do not use the built-in rules specified in the system makefile.
339.It Fl s 339.It Fl s
340Do not echo any commands as they are executed. 340Do not echo any commands as they are executed.
341Equivalent to specifying 341Equivalent to specifying
342.Ql Ic @ 342.Ql Ic @
343before each command line in the makefile. 343before each command line in the makefile.
344.It Fl T Ar tracefile 344.It Fl T Ar tracefile
345When used with the 345When used with the
346.Fl j 346.Fl j
347flag, 347flag,
348append a trace record to 348append a trace record to
349.Ar tracefile 349.Ar tracefile
350for each job started and completed. 350for each job started and completed.
351.It Fl t 351.It Fl t
352Rather than re-building a target as specified in the makefile, create it 352Rather than re-building a target as specified in the makefile, create it
353or update its modification time to make it appear up-to-date. 353or update its modification time to make it appear up-to-date.
354.It Fl V Ar variable 354.It Fl V Ar variable
355Print 355Print
356.Nm Ns 's 356.Nm Ns 's
357idea of the value of 357idea of the value of
358.Ar variable , 358.Ar variable ,
359in the global context. 359in the global context.
360Do not build any targets. 360Do not build any targets.
361Multiple instances of this option may be specified; 361Multiple instances of this option may be specified;
362the variables will be printed one per line, 362the variables will be printed one per line,
363with a blank line for each null or undefined variable. 363with a blank line for each null or undefined variable.
364If 364If
365.Ar variable 365.Ar variable
366contains a 366contains a
367.Ql \&$ 367.Ql \&$
368then the value will be expanded before printing. 368then the value will be expanded before printing.
369.It Fl W 369.It Fl W
370Treat any warnings during makefile parsing as errors. 370Treat any warnings during makefile parsing as errors.
371.It Fl X 371.It Fl X
372Don't export variables passed on the command line to the environment 372Don't export variables passed on the command line to the environment
373individually. 373individually.
374Variables passed on the command line are still exported 374Variables passed on the command line are still exported
375via the 375via the
376.Va MAKEFLAGS 376.Va MAKEFLAGS
377environment variable. 377environment variable.
378This option may be useful on systems which have a small limit on the 378This option may be useful on systems which have a small limit on the
379size of command arguments. 379size of command arguments.
380.It Ar variable=value 380.It Ar variable=value
381Set the value of the variable 381Set the value of the variable
382.Ar variable 382.Ar variable
383to 383to
384.Ar value . 384.Ar value .
385Normally, all values passed on the command line are also exported to 385Normally, all values passed on the command line are also exported to
386sub-makes in the environment. 386sub-makes in the environment.
387The 387The
388.Fl X 388.Fl X
389flag disables this behavior. 389flag disables this behavior.
390Variable assignments should follow options for POSIX compatibility 390Variable assignments should follow options for POSIX compatibility
391but no ordering is enforced. 391but no ordering is enforced.
392.El 392.El
393.Pp 393.Pp
394There are seven different types of lines in a makefile: file dependency 394There are seven different types of lines in a makefile: file dependency
395specifications, shell commands, variable assignments, include statements, 395specifications, shell commands, variable assignments, include statements,
396conditional directives, for loops, and comments. 396conditional directives, for loops, and comments.
397.Pp 397.Pp
398In general, lines may be continued from one line to the next by ending 398In general, lines may be continued from one line to the next by ending
399them with a backslash 399them with a backslash
400.Pq Ql \e . 400.Pq Ql \e .
401The trailing newline character and initial whitespace on the following 401The trailing newline character and initial whitespace on the following
402line are compressed into a single space. 402line are compressed into a single space.
403.Sh FILE DEPENDENCY SPECIFICATIONS 403.Sh FILE DEPENDENCY SPECIFICATIONS
404Dependency lines consist of one or more targets, an operator, and zero 404Dependency lines consist of one or more targets, an operator, and zero
405or more sources. 405or more sources.
406This creates a relationship where the targets 406This creates a relationship where the targets
407.Dq depend 407.Dq depend
408on the sources 408on the sources
409and are usually created from them. 409and are usually created from them.
410The exact relationship between the target and the source is determined 410The exact relationship between the target and the source is determined
411by the operator that separates them. 411by the operator that separates them.
412The three operators are as follows: 412The three operators are as follows:
413.Bl -tag -width flag 413.Bl -tag -width flag
414.It Ic \&: 414.It Ic \&:
415A target is considered out-of-date if its modification time is less than 415A target is considered out-of-date if its modification time is less than
416those of any of its sources. 416those of any of its sources.
417Sources for a target accumulate over dependency lines when this operator 417Sources for a target accumulate over dependency lines when this operator
418is used. 418is used.
419The target is removed if 419The target is removed if
420.Nm 420.Nm
421is interrupted. 421is interrupted.
422.It Ic \&! 422.It Ic \&!
423Targets are always re-created, but not until all sources have been 423Targets are always re-created, but not until all sources have been
424examined and re-created as necessary. 424examined and re-created as necessary.
425Sources for a target accumulate over dependency lines when this operator 425Sources for a target accumulate over dependency lines when this operator
426is used. 426is used.
427The target is removed if 427The target is removed if
428.Nm 428.Nm
429is interrupted. 429is interrupted.
430.It Ic \&:: 430.It Ic \&::
431If no sources are specified, the target is always re-created. 431If no sources are specified, the target is always re-created.
432Otherwise, a target is considered out-of-date if any of its sources has 432Otherwise, a target is considered out-of-date if any of its sources has
433been modified more recently than the target. 433been modified more recently than the target.
434Sources for a target do not accumulate over dependency lines when this 434Sources for a target do not accumulate over dependency lines when this
435operator is used. 435operator is used.
436The target will not be removed if 436The target will not be removed if
437.Nm 437.Nm
438is interrupted. 438is interrupted.
439.El 439.El
440.Pp 440.Pp
441Targets and sources may contain the shell wildcard values 441Targets and sources may contain the shell wildcard values
442.Ql \&? , 442.Ql \&? ,
443.Ql * , 443.Ql * ,
444.Ql [] , 444.Ql [] ,
445and 445and
446.Ql {} . 446.Ql {} .
447The values 447The values
448.Ql \&? , 448.Ql \&? ,
449.Ql * , 449.Ql * ,
450and 450and
451.Ql [] 451.Ql []
452may only be used as part of the final 452may only be used as part of the final
453component of the target or source, and must be used to describe existing 453component of the target or source, and must be used to describe existing
454files. 454files.
455The value 455The value
456.Ql {} 456.Ql {}
457need not necessarily be used to describe existing files. 457need not necessarily be used to describe existing files.
458Expansion is in directory order, not alphabetically as done in the shell. 458Expansion is in directory order, not alphabetically as done in the shell.
459.Sh SHELL COMMANDS 459.Sh SHELL COMMANDS
460Each target may have associated with it a series of shell commands, normally 460Each target may have associated with it a series of shell commands, normally
461used to create the target. 461used to create the target.
462Each of the commands in this script 462Each of the commands in this script
463.Em must 463.Em must
464be preceded by a tab. 464be preceded by a tab.
465While any target may appear on a dependency line, only one of these 465While any target may appear on a dependency line, only one of these
466dependencies may be followed by a creation script, unless the 466dependencies may be followed by a creation script, unless the
467.Ql Ic \&:: 467.Ql Ic \&::
468operator is used. 468operator is used.
469.Pp 469.Pp
470If the first characters of the command line are any combination of 470If the first characters of the command line are any combination of
471.Ql Ic @ , 471.Ql Ic @ ,
472.Ql Ic + , 472.Ql Ic + ,
473or 473or
474.Ql Ic \- , 474.Ql Ic \- ,
475the command is treated specially. 475the command is treated specially.
476A 476A
477.Ql Ic @ 477.Ql Ic @
478causes the command not to be echoed before it is executed. 478causes the command not to be echoed before it is executed.
479A 479A
480.Ql Ic + 480.Ql Ic +
481causes the command to be executed even when 481causes the command to be executed even when
482.Fl n 482.Fl n
483is given. 483is given.
484This is similar to the effect of the .MAKE special source, 484This is similar to the effect of the .MAKE special source,
485except that the effect can be limited to a single line of a script. 485except that the effect can be limited to a single line of a script.
486A 486A
487.Ql Ic \- 487.Ql Ic \-
488causes any non-zero exit status of the command line to be ignored. 488causes any non-zero exit status of the command line to be ignored.
489.Sh VARIABLE ASSIGNMENTS 489.Sh VARIABLE ASSIGNMENTS
490Variables in make are much like variables in the shell, and, by tradition, 490Variables in make are much like variables in the shell, and, by tradition,
491consist of all upper-case letters. 491consist of all upper-case letters.
492.Ss Variable assignment modifiers 492.Ss Variable assignment modifiers
493The five operators that can be used to assign values to variables are as 493The five operators that can be used to assign values to variables are as
494follows: 494follows:
495.Bl -tag -width Ds 495.Bl -tag -width Ds
496.It Ic \&= 496.It Ic \&=
497Assign the value to the variable. 497Assign the value to the variable.
498Any previous value is overridden. 498Any previous value is overridden.
499.It Ic \&+= 499.It Ic \&+=
500Append the value to the current value of the variable. 500Append the value to the current value of the variable.
501.It Ic \&?= 501.It Ic \&?=
502Assign the value to the variable if it is not already defined. 502Assign the value to the variable if it is not already defined.
503.It Ic \&:= 503.It Ic \&:=
504Assign with expansion, i.e. expand the value before assigning it 504Assign with expansion, i.e. expand the value before assigning it
505to the variable. 505to the variable.
506Normally, expansion is not done until the variable is referenced. 506Normally, expansion is not done until the variable is referenced.
507.Em NOTE : 507.Em NOTE :
508References to undefined variables are 508References to undefined variables are
509.Em not 509.Em not
510expanded. 510expanded.
511This can cause problems when variable modifiers are used. 511This can cause problems when variable modifiers are used.
512.It Ic \&!= 512.It Ic \&!=
513Expand the value and pass it to the shell for execution and assign 513Expand the value and pass it to the shell for execution and assign
514the result to the variable. 514the result to the variable.
515Any newlines in the result are replaced with spaces. 515Any newlines in the result are replaced with spaces.
516.El 516.El
517.Pp 517.Pp
518Any white-space before the assigned 518Any white-space before the assigned
519.Ar value 519.Ar value
520is removed; if the value is being appended, a single space is inserted 520is removed; if the value is being appended, a single space is inserted
521between the previous contents of the variable and the appended value. 521between the previous contents of the variable and the appended value.
522.Pp 522.Pp
523Variables are expanded by surrounding the variable name with either 523Variables are expanded by surrounding the variable name with either
524curly braces 524curly braces
525.Pq Ql {} 525.Pq Ql {}
526or parentheses 526or parentheses
527.Pq Ql () 527.Pq Ql ()
528and preceding it with 528and preceding it with
529a dollar sign 529a dollar sign
530.Pq Ql \&$ . 530.Pq Ql \&$ .
531If the variable name contains only a single letter, the surrounding 531If the variable name contains only a single letter, the surrounding
532braces or parentheses are not required. 532braces or parentheses are not required.
533This shorter form is not recommended. 533This shorter form is not recommended.
534.Pp 534.Pp
535If the variable name contains a dollar, then the name itself is expanded first. 535If the variable name contains a dollar, then the name itself is expanded first.
536This allows almost arbitrary variable names, however names containing dollar, 536This allows almost arbitrary variable names, however names containing dollar,
537braces, parenthesis, or whitespace are really best avoided! 537braces, parenthesis, or whitespace are really best avoided!
538.Pp 538.Pp
539If the result of expanding a variable contains a dollar sign 539If the result of expanding a variable contains a dollar sign
540.Pq Ql \&$ 540.Pq Ql \&$
541the string is expanded again. 541the string is expanded again.
542.Pp 542.Pp
543Variable substitution occurs at three distinct times, depending on where 543Variable substitution occurs at three distinct times, depending on where
544the variable is being used. 544the variable is being used.
545.Bl -enum 545.Bl -enum
546.It 546.It
547Variables in dependency lines are expanded as the line is read. 547Variables in dependency lines are expanded as the line is read.
548.It 548.It
549Variables in shell commands are expanded when the shell command is 549Variables in shell commands are expanded when the shell command is
550executed. 550executed.
551.It 551.It
552.Dq .for 552.Dq .for
553loop index variables are expanded on each loop iteration. 553loop index variables are expanded on each loop iteration.
554Note that other variables are not expanded inside loops so 554Note that other variables are not expanded inside loops so
555the following example code: 555the following example code:
556.Bd -literal -offset indent 556.Bd -literal -offset indent
557 557
558.Dv .for i in 1 2 3 558.Dv .for i in 1 2 3
559a+= ${i} 559a+= ${i}
560j= ${i} 560j= ${i}
561b+= ${j} 561b+= ${j}
562.Dv .endfor 562.Dv .endfor
563 563
564all: 564all:
565 @echo ${a} 565 @echo ${a}
566 @echo ${b} 566 @echo ${b}
567 567
568.Ed 568.Ed
569will print: 569will print:
570.Bd -literal -offset indent 570.Bd -literal -offset indent
5711 2 3 5711 2 3
5723 3 3 5723 3 3
573 573
574.Ed 574.Ed
575Because while ${a} contains 575Because while ${a} contains
576.Dq 1 2 3 576.Dq 1 2 3
577after the loop is executed, ${b} 577after the loop is executed, ${b}
578contains 578contains
579.Dq ${j} ${j} ${j} 579.Dq ${j} ${j} ${j}
580which expands to 580which expands to
581.Dq 3 3 3 581.Dq 3 3 3
582since after the loop completes ${j} contains 582since after the loop completes ${j} contains
583.Dq 3 . 583.Dq 3 .
584.El 584.El
585.Ss Variable classes 585.Ss Variable classes
586The four different classes of variables (in order of increasing precedence) 586The four different classes of variables (in order of increasing precedence)
587are: 587are:
588.Bl -tag -width Ds 588.Bl -tag -width Ds
589.It Environment variables 589.It Environment variables
590Variables defined as part of 590Variables defined as part of
591.Nm Ns 's 591.Nm Ns 's
592environment. 592environment.
593.It Global variables 593.It Global variables
594Variables defined in the makefile or in included makefiles. 594Variables defined in the makefile or in included makefiles.
595.It Command line variables 595.It Command line variables
596Variables defined as part of the command line. 596Variables defined as part of the command line.
597.It Local variables 597.It Local variables
598Variables that are defined specific to a certain target. 598Variables that are defined specific to a certain target.
599The seven local variables are as follows: 599The seven local variables are as follows:
600.Bl -tag -width ".ARCHIVE" 600.Bl -tag -width ".ARCHIVE"
601.It Va .ALLSRC 601.It Va .ALLSRC
602The list of all sources for this target; also known as 602The list of all sources for this target; also known as
603.Ql Va \&\*[Gt] . 603.Ql Va \&\*[Gt] .
604.It Va .ARCHIVE 604.It Va .ARCHIVE
605The name of the archive file. 605The name of the archive file.
606.It Va .IMPSRC 606.It Va .IMPSRC
607In suffix-transformation rules, the name/path of the source from which the 607In suffix-transformation rules, the name/path of the source from which the
608target is to be transformed (the 608target is to be transformed (the
609.Dq implied 609.Dq implied
610source); also known as 610source); also known as
611.Ql Va \&\*[Lt] . 611.Ql Va \&\*[Lt] .
612It is not defined in explicit rules. 612It is not defined in explicit rules.
613.It Va .MEMBER 613.It Va .MEMBER
614The name of the archive member. 614The name of the archive member.
615.It Va .OODATE 615.It Va .OODATE
616The list of sources for this target that were deemed out-of-date; also 616The list of sources for this target that were deemed out-of-date; also
617known as 617known as
618.Ql Va \&? . 618.Ql Va \&? .
619.It Va .PREFIX 619.It Va .PREFIX
620The file prefix of the target, containing only the file portion, no suffix 620The file prefix of the target, containing only the file portion, no suffix
621or preceding directory components; also known as 621or preceding directory components; also known as
622.Ql Va * . 622.Ql Va * .
623.It Va .TARGET 623.It Va .TARGET
624The name of the target; also known as 624The name of the target; also known as
625.Ql Va @ . 625.Ql Va @ .
626.El 626.El
627.Pp 627.Pp
628The shorter forms 628The shorter forms
629.Ql Va @ , 629.Ql Va @ ,
630.Ql Va \&? , 630.Ql Va \&? ,
631.Ql Va \&\*[Lt] , 631.Ql Va \&\*[Lt] ,
632.Ql Va \&\*[Gt] , 632.Ql Va \&\*[Gt] ,
633and 633and
634.Ql Va * 634.Ql Va *
635are permitted for backward 635are permitted for backward
636compatibility with historical makefiles and are not recommended. 636compatibility with historical makefiles and are not recommended.
637The six variables 637The six variables
638.Ql Va "@F" , 638.Ql Va "@F" ,
639.Ql Va "@D" , 639.Ql Va "@D" ,
640.Ql Va "\*[Lt]F" , 640.Ql Va "\*[Lt]F" ,
641.Ql Va "\*[Lt]D" , 641.Ql Va "\*[Lt]D" ,
642.Ql Va "*F" , 642.Ql Va "*F" ,
643and 643and
644.Ql Va "*D" 644.Ql Va "*D"
645are permitted for compatibility with 645are permitted for compatibility with
646.At V 646.At V
647makefiles and are not recommended. 647makefiles and are not recommended.
648.Pp 648.Pp
649Four of the local variables may be used in sources on dependency lines 649Four of the local variables may be used in sources on dependency lines
650because they expand to the proper value for each target on the line. 650because they expand to the proper value for each target on the line.
651These variables are 651These variables are
652.Ql Va .TARGET , 652.Ql Va .TARGET ,
653.Ql Va .PREFIX , 653.Ql Va .PREFIX ,
654.Ql Va .ARCHIVE , 654.Ql Va .ARCHIVE ,
655and 655and
656.Ql Va .MEMBER . 656.Ql Va .MEMBER .
657.El 657.El
658.Ss Additional built-in variables 658.Ss Additional built-in variables
659In addition, 659In addition,
660.Nm 660.Nm
661sets or knows about the following variables: 661sets or knows about the following variables:
662.Bl -tag -width .MAKEOVERRIDES 662.Bl -tag -width .MAKEOVERRIDES
663.It Va \&$ 663.It Va \&$
664A single dollar sign 664A single dollar sign
665.Ql \&$ , 665.Ql \&$ ,
666i.e. 666i.e.
667.Ql \&$$ 667.Ql \&$$
668expands to a single dollar 668expands to a single dollar
669sign. 669sign.
670.It Va .ALLTARGETS 670.It Va .ALLTARGETS
671The list of all targets encountered in the Makefile. 671The list of all targets encountered in the Makefile.
672If evaluated during 672If evaluated during
673Makefile parsing, lists only those targets encountered thus far. 673Makefile parsing, lists only those targets encountered thus far.
674.It Va .CURDIR 674.It Va .CURDIR
675A path to the directory where 675A path to the directory where
676.Nm 676.Nm
677was executed. 677was executed.
678Refer to the description of 678Refer to the description of
679.Ql Ev PWD 679.Ql Ev PWD
680for more details. 680for more details.
681.It Ev MAKE 681.It Ev MAKE
682The name that 682The name that
683.Nm 683.Nm
684was executed with 684was executed with
685.Pq Va argv[0] . 685.Pq Va argv[0] .
686For compatibility 686For compatibility
687.Nm 687.Nm
688also sets 688also sets
689.Va .MAKE 689.Va .MAKE
690with the same value. 690with the same value.
691The preferred variable to use is the environment variable 691The preferred variable to use is the environment variable
692.Ev MAKE 692.Ev MAKE
693because it is more compatible with other versions of 693because it is more compatible with other versions of
694.Nm 694.Nm
695and cannot be confused with the special target with the same name. 695and cannot be confused with the special target with the same name.
696.It Va .MAKE.DEPENDFILE 696.It Va .MAKE.DEPENDFILE
697Names the makefile (default 697Names the makefile (default
698.Ql Pa .depend ) 698.Ql Pa .depend )
699from which generated dependencies are read. 699from which generated dependencies are read.
700.It Va .MAKE.EXPORTED 700.It Va .MAKE.EXPORTED
701The list of variables exported by 701The list of variables exported by
702.Nm . 702.Nm .
703.It Va .MAKE.JOBS 703.It Va .MAKE.JOBS
704The argument to the 704The argument to the
705.Fl j 705.Fl j
706option. 706option.
707.It Va .MAKE.JOB.PREFIX 707.It Va .MAKE.JOB.PREFIX
708If 708If
709.Nm 709.Nm
710is run with 710is run with
711.Ar j 711.Ar j
712then output for each target is prefixed with a token 712then output for each target is prefixed with a token
713.Ql --- target --- 713.Ql --- target ---
714the first part of which can be controlled via 714the first part of which can be controlled via
715.Va .MAKE.JOB.PREFIX . 715.Va .MAKE.JOB.PREFIX .
716.br 716.br
717For example: 717For example:
718.Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] 718.Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
719would produce tokens like 719would produce tokens like
720.Ql ---make[1234] target --- 720.Ql ---make[1234] target ---
721making it easier to track the degree of parallelism being achieved. 721making it easier to track the degree of parallelism being achieved.
722.It Ev MAKEFLAGS 722.It Ev MAKEFLAGS
723The environment variable 723The environment variable
724.Ql Ev MAKEFLAGS 724.Ql Ev MAKEFLAGS
725may contain anything that 725may contain anything that
726may be specified on 726may be specified on
727.Nm Ns 's 727.Nm Ns 's
728command line. 728command line.
729Anything specified on 729Anything specified on
730.Nm Ns 's 730.Nm Ns 's
731command line is appended to the 731command line is appended to the
732.Ql Ev MAKEFLAGS 732.Ql Ev MAKEFLAGS
733variable which is then 733variable which is then
734entered into the environment for all programs which 734entered into the environment for all programs which
735.Nm 735.Nm
736executes. 736executes.
737.It Va .MAKE.LEVEL 737.It Va .MAKE.LEVEL
738The recursion depth of 738The recursion depth of
739.Nm . 739.Nm .
740The initial instance of 740The initial instance of
741.Nm 741.Nm
742will be 0, and an incremented value is put into the environment 742will be 0, and an incremented value is put into the environment
743to be seen by the next generation. 743to be seen by the next generation.
744This allows tests like: 744This allows tests like:
745.Li .if ${.MAKE.LEVEL} == 0 745.Li .if ${.MAKE.LEVEL} == 0
746to protect things which should only be evaluated in the initial instance of 746to protect things which should only be evaluated in the initial instance of
747.Nm . 747.Nm .
748.It Va .MAKE.MAKEFILE_PREFERENCE 748.It Va .MAKE.MAKEFILE_PREFERENCE
749The ordered list of makefile names 749The ordered list of makefile names
750(default 750(default
751.Ql Pa makefile , 751.Ql Pa makefile ,
752.Ql Pa Makefile ) 752.Ql Pa Makefile )
753that 753that
754.Nm 754.Nm
755will look for. 755will look for.
756.It Va .MAKE.MAKEFILES 756.It Va .MAKE.MAKEFILES
757The list of makefiles read by 757The list of makefiles read by
758.Nm , 758.Nm ,
759which is useful for tracking dependencies. 759which is useful for tracking dependencies.
760Each makefile is recorded only once, regardless of the number of times read. 760Each makefile is recorded only once, regardless of the number of times read.
761.It Va .MAKE.MODE 761.It Va .MAKE.MODE
762Processed after reading all makefiles. 762Processed after reading all makefiles.
763Can affect the mode that 763Can affect the mode that
764.Nm 764.Nm
765runs in. 765runs in.
766It can contain a number of keywords: 766It can contain a number of keywords:
767.Bl -hang -width ignore-cmd 767.Bl -hang -width ignore-cmd
768.It Pa compat 768.It Pa compat
769Like 769Like
770.Fl B , 770.Fl B ,
771puts 771puts
772.Nm 772.Nm
773into "compat" mode. 773into "compat" mode.
774.It Pa meta 774.It Pa meta
775Puts 775Puts
776.Nm 776.Nm
777into "meta" mode, where meta files are created for each target 777into "meta" mode, where meta files are created for each target
778to capture the command run, the output generated and if 778to capture the command run, the output generated and if
779.Xr filemon 4 779.Xr filemon 4
780is available, the system calls which are of interest to 780is available, the system calls which are of interest to
781.Nm . 781.Nm .
782The captured output can be very useful when diagnosing errors. 782The captured output can be very useful when diagnosing errors.
783.It Pa curdirOk= Ar bf 783.It Pa curdirOk= Ar bf
784Normally 784Normally
785.Nm 785.Nm
786will not create .meta files in 786will not create .meta files in
787.Ql Va .CURDIR . 787.Ql Va .CURDIR .
788This can be overridden by setting 788This can be overridden by setting
789.Va bf 789.Va bf
790to a value which represents True. 790to a value which represents True.
791.It Pa verbose 791.It Pa verbose
792If in "meta" mode, print a clue about the target being built. 792If in "meta" mode, print a clue about the target being built.
793This is useful if the build is otherwise running silently. 793This is useful if the build is otherwise running silently.
794The message printed the value of: 794The message printed the value of:
795.Va .MAKE.META.PREFIX . 795.Va .MAKE.META.PREFIX .
796.It Pa ignore-cmd 796.It Pa ignore-cmd
797Some makefiles have commands which are simply not stable. 797Some makefiles have commands which are simply not stable.
798This keyword causes them to be ignored for 798This keyword causes them to be ignored for
799determining whether a target is out of date in "meta" mode. 799determining whether a target is out of date in "meta" mode.
800See also 800See also
801.Ic .NOMETA_CMP . 801.Ic .NOMETA_CMP .
802.It Pa silent= Ar bf 802.It Pa silent= Ar bf
803If 803If
804.Va bf 804.Va bf
805is True, when a .meta file is created, mark the target 805is True, when a .meta file is created, mark the target
806.El 806.El
807.It Va .MAKE.META.BAILIWICK 807.It Va .MAKE.META.BAILIWICK
808In "meta" mode, provides a list of prefixes which 808In "meta" mode, provides a list of prefixes which
809match the directories controlled by 809match the directories controlled by
810.Nm . 810.Nm .
811If a file that was generated outside of 811If a file that was generated outside of
812.Va .OBJDIR 812.Va .OBJDIR
813but within said bailiwick is missing, 813but within said bailiwick is missing,
814the current target is considered out-of-date. 814the current target is considered out-of-date.
815.It Va .MAKE.META.CREATED 815.It Va .MAKE.META.CREATED
816In "meta" mode, this variable contains a list of all the meta files 816In "meta" mode, this variable contains a list of all the meta files
817updated. 817updated.
818If not empty, it can be used to trigger processing of 818If not empty, it can be used to trigger processing of
819.Va .MAKE.META.FILES . 819.Va .MAKE.META.FILES .
820.It Va .MAKE.META.FILES 820.It Va .MAKE.META.FILES
821In "meta" mode, this variable contains a list of all the meta files 821In "meta" mode, this variable contains a list of all the meta files
822used (updated or not). 822used (updated or not).
823This list can be used to process the meta files to extract dependency 823This list can be used to process the meta files to extract dependency
824information. 824information.
825.It Va .MAKE.META.PREFIX 825.It Va .MAKE.META.PREFIX
826Defines the message printed for each meta file updated in "meta verbose" mode. 826Defines the message printed for each meta file updated in "meta verbose" mode.
827The default value is: 827The default value is:
828.Dl Building ${.TARGET:H:tA}/${.TARGET:T} 828.Dl Building ${.TARGET:H:tA}/${.TARGET:T}
829.It Va .MAKEOVERRIDES 829.It Va .MAKEOVERRIDES
830This variable is used to record the names of variables assigned to 830This variable is used to record the names of variables assigned to
831on the command line, so that they may be exported as part of 831on the command line, so that they may be exported as part of
832.Ql Ev MAKEFLAGS . 832.Ql Ev MAKEFLAGS .
833This behaviour can be disabled by assigning an empty value to 833This behaviour can be disabled by assigning an empty value to
834.Ql Va .MAKEOVERRIDES 834.Ql Va .MAKEOVERRIDES
835within a makefile. 835within a makefile.
836Extra variables can be exported from a makefile 836Extra variables can be exported from a makefile
837by appending their names to 837by appending their names to
838.Ql Va .MAKEOVERRIDES . 838.Ql Va .MAKEOVERRIDES .
839.Ql Ev MAKEFLAGS 839.Ql Ev MAKEFLAGS
840is re-exported whenever 840is re-exported whenever
841.Ql Va .MAKEOVERRIDES 841.Ql Va .MAKEOVERRIDES
842is modified. 842is modified.
843.It Va .MAKE.PID 843.It Va .MAKE.PID
844The process-id of 844The process-id of
845.Nm . 845.Nm .
846.It Va .MAKE.PPID 846.It Va .MAKE.PPID
847The parent process-id of 847The parent process-id of
848.Nm . 848.Nm .
849.It Va MAKE_PRINT_VAR_ON_ERROR 849.It Va MAKE_PRINT_VAR_ON_ERROR
850When 850When
851.Nm 851.Nm
852stops due to an error, it prints its name and the value of 852stops due to an error, it prints its name and the value of
853.Ql Va .CURDIR 853.Ql Va .CURDIR
854as well as the value of any variables named in 854as well as the value of any variables named in
855.Ql Va MAKE_PRINT_VAR_ON_ERROR . 855.Ql Va MAKE_PRINT_VAR_ON_ERROR .
856.It Va .newline 856.It Va .newline
857This variable is simply assigned a newline character as its value. 857This variable is simply assigned a newline character as its value.
858This allows expansions using the 858This allows expansions using the
859.Cm \&:@ 859.Cm \&:@
860modifier to put a newline between 860modifier to put a newline between
861iterations of the loop rather than a space. 861iterations of the loop rather than a space.
862For example, the printing of 862For example, the printing of
863.Ql Va MAKE_PRINT_VAR_ON_ERROR 863.Ql Va MAKE_PRINT_VAR_ON_ERROR
864could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. 864could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}.
865.It Va .OBJDIR 865.It Va .OBJDIR
866A path to the directory where the targets are built. 866A path to the directory where the targets are built.
867Its value is determined by trying to 867Its value is determined by trying to
868.Xr chdir 2 868.Xr chdir 2
869to the following directories in order and using the first match: 869to the following directories in order and using the first match:
870.Bl -enum 870.Bl -enum
871.It 871.It
872.Ev ${MAKEOBJDIRPREFIX}${.CURDIR} 872.Ev ${MAKEOBJDIRPREFIX}${.CURDIR}
873.Pp 873.Pp
874(Only if 874(Only if
875.Ql Ev MAKEOBJDIRPREFIX 875.Ql Ev MAKEOBJDIRPREFIX
876is set in the environment or on the command line.) 876is set in the environment or on the command line.)
877.It 877.It
878.Ev ${MAKEOBJDIR} 878.Ev ${MAKEOBJDIR}
879.Pp 879.Pp
880(Only if 880(Only if
881.Ql Ev MAKEOBJDIR 881.Ql Ev MAKEOBJDIR
882is set in the environment or on the command line.) 882is set in the environment or on the command line.)
883.It 883.It
884.Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE} 884.Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE}
885.It 885.It
886.Ev ${.CURDIR} Ns Pa /obj 886.Ev ${.CURDIR} Ns Pa /obj
887.It 887.It
888.Pa /usr/obj/ Ns Ev ${.CURDIR} 888.Pa /usr/obj/ Ns Ev ${.CURDIR}
889.It 889.It
890.Ev ${.CURDIR} 890.Ev ${.CURDIR}
891.El 891.El
892.Pp 892.Pp
893Variable expansion is performed on the value before it's used, 893Variable expansion is performed on the value before it's used,
894so expressions such as 894so expressions such as
895.Dl ${.CURDIR:S,^/usr/src,/var/obj,} 895.Dl ${.CURDIR:S,^/usr/src,/var/obj,}
896may be used. 896may be used.
897This is especially useful with 897This is especially useful with
898.Ql Ev MAKEOBJDIR . 898.Ql Ev MAKEOBJDIR .
899.Pp 899.Pp
900.Ql Va .OBJDIR 900.Ql Va .OBJDIR
901may be modified in the makefile as a global variable. 901may be modified in the makefile as a global variable.
902In all cases, 902In all cases,
903.Nm 903.Nm
904will 904will
905.Xr chdir 2 905.Xr chdir 2
906to 906to
907.Ql Va .OBJDIR 907.Ql Va .OBJDIR
908and set 908and set
909.Ql Ev PWD 909.Ql Ev PWD
910to that directory before executing any targets. 910to that directory before executing any targets.
911. 911.
912.It Va .PARSEDIR 912.It Va .PARSEDIR
913A path to the directory of the current 913A path to the directory of the current
914.Ql Pa Makefile 914.Ql Pa Makefile
915being parsed. 915being parsed.
916.It Va .PARSEFILE 916.It Va .PARSEFILE
917The basename of the current 917The basename of the current
918.Ql Pa Makefile 918.Ql Pa Makefile
919being parsed. 919being parsed.
920This variable and 920This variable and
921.Ql Va .PARSEDIR 921.Ql Va .PARSEDIR
922are both set only while the 922are both set only while the
923.Ql Pa Makefiles 923.Ql Pa Makefiles
924are being parsed. 924are being parsed.
925If you want to retain their current values, assign them to a variable 925If you want to retain their current values, assign them to a variable
926using assignment with expansion: 926using assignment with expansion:
927.Pq Ql Cm \&:= . 927.Pq Ql Cm \&:= .
928.It Va .PATH 928.It Va .PATH
929A variable that represents the list of directories that 929A variable that represents the list of directories that
930.Nm 930.Nm
931will search for files. 931will search for files.
932The search list should be updated using the target 932The search list should be updated using the target
933.Ql Va .PATH 933.Ql Va .PATH
934rather than the variable. 934rather than the variable.
935.It Ev PWD 935.It Ev PWD
936Alternate path to the current directory. 936Alternate path to the current directory.
937.Nm 937.Nm
938normally sets 938normally sets
939.Ql Va .CURDIR 939.Ql Va .CURDIR
940to the canonical path given by 940to the canonical path given by
941.Xr getcwd 3 . 941.Xr getcwd 3 .
942However, if the environment variable 942However, if the environment variable
943.Ql Ev PWD 943.Ql Ev PWD
944is set and gives a path to the current directory, then 944is set and gives a path to the current directory, then
945.Nm 945.Nm
946sets 946sets
947.Ql Va .CURDIR 947.Ql Va .CURDIR
948to the value of 948to the value of
949.Ql Ev PWD 949.Ql Ev PWD
950instead. 950instead.
951This behaviour is disabled if 951This behaviour is disabled if
952.Ql Ev MAKEOBJDIRPREFIX 952.Ql Ev MAKEOBJDIRPREFIX
953is set or 953is set or
954.Ql Ev MAKEOBJDIR 954.Ql Ev MAKEOBJDIR
955contains a variable transform. 955contains a variable transform.
956.Ql Ev PWD 956.Ql Ev PWD
957is set to the value of 957is set to the value of
958.Ql Va .OBJDIR 958.Ql Va .OBJDIR
959for all programs which 959for all programs which
960.Nm 960.Nm
961executes. 961executes.
962.It Ev .TARGETS 962.It Ev .TARGETS
963The list of targets explicitly specified on the command line, if any. 963The list of targets explicitly specified on the command line, if any.
964.It Ev VPATH 964.It Ev VPATH
965Colon-separated 965Colon-separated
966.Pq Dq \&: 966.Pq Dq \&:
967lists of directories that 967lists of directories that
968.Nm 968.Nm
969will search for files. 969will search for files.
970The variable is supported for compatibility with old make programs only, 970The variable is supported for compatibility with old make programs only,
971use 971use
972.Ql Va .PATH 972.Ql Va .PATH
973instead. 973instead.
974.El 974.El
975.Ss Variable modifiers 975.Ss Variable modifiers
976Variable expansion may be modified to select or modify each word of the 976Variable expansion may be modified to select or modify each word of the
977variable (where a 977variable (where a
978.Dq word 978.Dq word
979is white-space delimited sequence of characters). 979is white-space delimited sequence of characters).
980The general format of a variable expansion is as follows: 980The general format of a variable expansion is as follows:
981.Pp 981.Pp
982.Dl ${variable[:modifier[:...]]} 982.Dl ${variable[:modifier[:...]]}
983.Pp 983.Pp
984Each modifier begins with a colon, 984Each modifier begins with a colon,
985which may be escaped with a backslash 985which may be escaped with a backslash
986.Pq Ql \e . 986.Pq Ql \e .
987.Pp 987.Pp
988A set of modifiers can be specified via a variable, as follows: 988A set of modifiers can be specified via a variable, as follows:
989.Pp 989.Pp
990.Dl modifier_variable=modifier[:...] 990.Dl modifier_variable=modifier[:...]
991.Dl ${variable:${modifier_variable}[:...]} 991.Dl ${variable:${modifier_variable}[:...]}
992.Pp 992.Pp
993In this case the first modifier in the modifier_variable does not 993In this case the first modifier in the modifier_variable does not
994start with a colon, since that must appear in the referencing 994start with a colon, since that must appear in the referencing
995variable. 995variable.
996If any of the modifiers in the modifier_variable contain a dollar sign 996If any of the modifiers in the modifier_variable contain a dollar sign
997.Pq Ql $ , 997.Pq Ql $ ,
998these must be doubled to avoid early expansion. 998these must be doubled to avoid early expansion.
999.Pp 999.Pp
1000The supported modifiers are: 1000The supported modifiers are:
1001.Bl -tag -width EEE 1001.Bl -tag -width EEE
1002.It Cm \&:E 1002.It Cm \&:E
1003Replaces each word in the variable with its suffix. 1003Replaces each word in the variable with its suffix.
1004.It Cm \&:H 1004.It Cm \&:H
1005Replaces each word in the variable with everything but the last component. 1005Replaces each word in the variable with everything but the last component.
1006.It Cm \&:M Ns Ar pattern 1006.It Cm \&:M Ns Ar pattern
1007Select only those words that match 1007Select only those words that match
1008.Ar pattern . 1008.Ar pattern .
1009The standard shell wildcard characters 1009The standard shell wildcard characters
1010.Pf ( Ql * , 1010.Pf ( Ql * ,
1011.Ql \&? , 1011.Ql \&? ,
1012and 1012and
1013.Ql Oo Oc ) 1013.Ql Oo Oc )
1014may 1014may
1015be used. 1015be used.
1016The wildcard characters may be escaped with a backslash 1016The wildcard characters may be escaped with a backslash
1017.Pq Ql \e . 1017.Pq Ql \e .
1018.It Cm \&:N Ns Ar pattern 1018.It Cm \&:N Ns Ar pattern
1019This is identical to 1019This is identical to
1020.Ql Cm \&:M , 1020.Ql Cm \&:M ,
1021but selects all words which do not match 1021but selects all words which do not match
1022.Ar pattern . 1022.Ar pattern .
1023.It Cm \&:O 1023.It Cm \&:O
1024Order every word in variable alphabetically. 1024Order every word in variable alphabetically.
1025To sort words in 1025To sort words in
1026reverse order use the 1026reverse order use the
1027.Ql Cm \&:O:[-1..1] 1027.Ql Cm \&:O:[-1..1]
1028combination of modifiers. 1028combination of modifiers.
1029.It Cm \&:Ox 1029.It Cm \&:Ox
1030Randomize words in variable. 1030Randomize words in variable.
1031The results will be different each time you are referring to the 1031The results will be different each time you are referring to the
1032modified variable; use the assignment with expansion 1032modified variable; use the assignment with expansion
1033.Pq Ql Cm \&:= 1033.Pq Ql Cm \&:=
1034to prevent such behaviour. 1034to prevent such behaviour.
1035For example, 1035For example,
1036.Bd -literal -offset indent 1036.Bd -literal -offset indent
1037LIST= uno due tre quattro 1037LIST= uno due tre quattro
1038RANDOM_LIST= ${LIST:Ox} 1038RANDOM_LIST= ${LIST:Ox}
1039STATIC_RANDOM_LIST:= ${LIST:Ox} 1039STATIC_RANDOM_LIST:= ${LIST:Ox}
1040 1040
1041all: 1041all:
1042 @echo "${RANDOM_LIST}" 1042 @echo "${RANDOM_LIST}"
1043 @echo "${RANDOM_LIST}" 1043 @echo "${RANDOM_LIST}"
1044 @echo "${STATIC_RANDOM_LIST}" 1044 @echo "${STATIC_RANDOM_LIST}"
1045 @echo "${STATIC_RANDOM_LIST}" 1045 @echo "${STATIC_RANDOM_LIST}"
1046.Ed 1046.Ed
1047may produce output similar to: 1047may produce output similar to:
1048.Bd -literal -offset indent 1048.Bd -literal -offset indent
1049quattro due tre uno 1049quattro due tre uno
1050tre due quattro uno 1050tre due quattro uno
1051due uno quattro tre 1051due uno quattro tre
1052due uno quattro tre 1052due uno quattro tre
1053.Ed 1053.Ed
1054.It Cm \&:Q 1054.It Cm \&:Q
1055Quotes every shell meta-character in the variable, so that it can be passed 1055Quotes every shell meta-character in the variable, so that it can be passed
1056safely through recursive invocations of 1056safely through recursive invocations of
1057.Nm . 1057.Nm .
1058.It Cm \&:R 1058.It Cm \&:R
1059Replaces each word in the variable with everything but its suffix. 1059Replaces each word in the variable with everything but its suffix.
1060.It Cm \&:gmtime 1060.It Cm \&:gmtime
1061The value is a format string for 1061The value is a format string for
1062.Xr strftime 3 , 1062.Xr strftime 3 ,
1063using the current 1063using the current
1064.Xr gmtime 3 . 1064.Xr gmtime 3 .
1065.It Cm \&:hash 1065.It Cm \&:hash
1066Compute a 32bit hash of the value and encode it as hex digits. 1066Compute a 32bit hash of the value and encode it as hex digits.
1067.It Cm \&:localtime 1067.It Cm \&:localtime
1068The value is a format string for 1068The value is a format string for
1069.Xr strftime 3 , 1069.Xr strftime 3 ,
1070using the current 1070using the current
1071.Xr localtime 3 . 1071.Xr localtime 3 .
1072.It Cm \&:tA 1072.It Cm \&:tA
1073Attempt to convert variable to an absolute path using 1073Attempt to convert variable to an absolute path using
1074.Xr realpath 3 , 1074.Xr realpath 3 ,
1075if that fails, the value is unchanged. 1075if that fails, the value is unchanged.
1076.It Cm \&:tl 1076.It Cm \&:tl
1077Converts variable to lower-case letters. 1077Converts variable to lower-case letters.
1078.It Cm \&:ts Ns Ar c 1078.It Cm \&:ts Ns Ar c
1079Words in the variable are normally separated by a space on expansion. 1079Words in the variable are normally separated by a space on expansion.
1080This modifier sets the separator to the character 1080This modifier sets the separator to the character
1081.Ar c . 1081.Ar c .
1082If 1082If
1083.Ar c 1083.Ar c
1084is omitted, then no separator is used. 1084is omitted, then no separator is used.
1085The common escapes (including octal numeric codes), work as expected. 1085The common escapes (including octal numeric codes), work as expected.
1086.It Cm \&:tu 1086.It Cm \&:tu
1087Converts variable to upper-case letters. 1087Converts variable to upper-case letters.
1088.It Cm \&:tW 1088.It Cm \&:tW
1089Causes the value to be treated as a single word 1089Causes the value to be treated as a single word
1090(possibly containing embedded white space). 1090(possibly containing embedded white space).
1091See also 1091See also
1092.Ql Cm \&:[*] . 1092.Ql Cm \&:[*] .
1093.It Cm \&:tw 1093.It Cm \&:tw
1094Causes the value to be treated as a sequence of 1094Causes the value to be treated as a sequence of
1095words delimited by white space. 1095words delimited by white space.
1096See also 1096See also
1097.Ql Cm \&:[@] . 1097.Ql Cm \&:[@] .
1098.Sm off 1098.Sm off
1099.It Cm \&:S No \&/ Ar old_string No \&/ Ar new_string No \&/ Op Cm 1gW 1099.It Cm \&:S No \&/ Ar old_string No \&/ Ar new_string No \&/ Op Cm 1gW
1100.Sm on 1100.Sm on
1101Modify the first occurrence of 1101Modify the first occurrence of
1102.Ar old_string 1102.Ar old_string
1103in the variable's value, replacing it with 1103in the variable's value, replacing it with
1104.Ar new_string . 1104.Ar new_string .
1105If a 1105If a
1106.Ql g 1106.Ql g
1107is appended to the last slash of the pattern, all occurrences 1107is appended to the last slash of the pattern, all occurrences
1108in each word are replaced. 1108in each word are replaced.
1109If a 1109If a
1110.Ql 1 1110.Ql 1
1111is appended to the last slash of the pattern, only the first word 1111is appended to the last slash of the pattern, only the first word
1112is affected. 1112is affected.
1113If a 1113If a
1114.Ql W 1114.Ql W
1115is appended to the last slash of the pattern, 1115is appended to the last slash of the pattern,
1116then the value is treated as a single word 1116then the value is treated as a single word
1117(possibly containing embedded white space). 1117(possibly containing embedded white space).
1118If 1118If
1119.Ar old_string 1119.Ar old_string
1120begins with a caret 1120begins with a caret
1121.Pq Ql ^ , 1121.Pq Ql ^ ,
1122.Ar old_string 1122.Ar old_string
1123is anchored at the beginning of each word. 1123is anchored at the beginning of each word.
1124If 1124If
1125.Ar old_string 1125.Ar old_string
1126ends with a dollar sign 1126ends with a dollar sign
1127.Pq Ql \&$ , 1127.Pq Ql \&$ ,
1128it is anchored at the end of each word. 1128it is anchored at the end of each word.
1129Inside 1129Inside
1130.Ar new_string , 1130.Ar new_string ,
1131an ampersand 1131an ampersand
1132.Pq Ql \*[Am] 1132.Pq Ql \*[Am]
1133is replaced by 1133is replaced by
1134.Ar old_string 1134.Ar old_string
1135(without any 1135(without any
1136.Ql ^ 1136.Ql ^
1137or 1137or
1138.Ql \&$ ) . 1138.Ql \&$ ) .
1139Any character may be used as a delimiter for the parts of the modifier 1139Any character may be used as a delimiter for the parts of the modifier
1140string. 1140string.
1141The anchoring, ampersand and delimiter characters may be escaped with a 1141The anchoring, ampersand and delimiter characters may be escaped with a
1142backslash 1142backslash
1143.Pq Ql \e . 1143.Pq Ql \e .
1144.Pp 1144.Pp
1145Variable expansion occurs in the normal fashion inside both 1145Variable expansion occurs in the normal fashion inside both
1146.Ar old_string 1146.Ar old_string
1147and 1147and
1148.Ar new_string 1148.Ar new_string
1149with the single exception that a backslash is used to prevent the expansion 1149with the single exception that a backslash is used to prevent the expansion
1150of a dollar sign 1150of a dollar sign
1151.Pq Ql \&$ , 1151.Pq Ql \&$ ,
1152not a preceding dollar sign as is usual. 1152not a preceding dollar sign as is usual.
1153.Sm off 1153.Sm off
1154.It Cm \&:C No \&/ Ar pattern No \&/ Ar replacement No \&/ Op Cm 1gW 1154.It Cm \&:C No \&/ Ar pattern No \&/ Ar replacement No \&/ Op Cm 1gW
1155.Sm on 1155.Sm on
1156The 1156The
1157.Cm \&:C 1157.Cm \&:C
1158modifier is just like the 1158modifier is just like the
1159.Cm \&:S 1159.Cm \&:S
1160modifier except that the old and new strings, instead of being 1160modifier except that the old and new strings, instead of being
1161simple strings, are a regular expression (see 1161simple strings, are a regular expression (see
1162.Xr regex 3 ) 1162.Xr regex 3 )
1163string 1163string
1164.Ar pattern 1164.Ar pattern
1165and an 1165and an
1166.Xr ed 1 Ns \-style 1166.Xr ed 1 Ns \-style
1167string 1167string
1168.Ar replacement . 1168.Ar replacement .
1169Normally, the first occurrence of the pattern 1169Normally, the first occurrence of the pattern
1170.Ar pattern 1170.Ar pattern
1171in each word of the value is substituted with 1171in each word of the value is substituted with
1172.Ar replacement . 1172.Ar replacement .
1173The 1173The
1174.Ql 1 1174.Ql 1
1175modifier causes the substitution to apply to at most one word; the 1175modifier causes the substitution to apply to at most one word; the
1176.Ql g 1176.Ql g
1177modifier causes the substitution to apply to as many instances of the 1177modifier causes the substitution to apply to as many instances of the
1178search pattern 1178search pattern
1179.Ar pattern 1179.Ar pattern
1180as occur in the word or words it is found in; the 1180as occur in the word or words it is found in; the
1181.Ql W 1181.Ql W
1182modifier causes the value to be treated as a single word 1182modifier causes the value to be treated as a single word
1183(possibly containing embedded white space). 1183(possibly containing embedded white space).
1184Note that 1184Note that
1185.Ql 1 1185.Ql 1
1186and 1186and
1187.Ql g 1187.Ql g
1188are orthogonal; the former specifies whether multiple words are 1188are orthogonal; the former specifies whether multiple words are
1189potentially affected, the latter whether multiple substitutions can 1189potentially affected, the latter whether multiple substitutions can
1190potentially occur within each affected word. 1190potentially occur within each affected word.
1191.It Cm \&:T 1191.It Cm \&:T
1192Replaces each word in the variable with its last component. 1192Replaces each word in the variable with its last component.
1193.It Cm \&:u 1193.It Cm \&:u
1194Remove adjacent duplicate words (like 1194Remove adjacent duplicate words (like
1195.Xr uniq 1 ) . 1195.Xr uniq 1 ) .
1196.Sm off 1196.Sm off
1197.It Cm \&:\&? Ar true_string Cm \&: Ar false_string 1197.It Cm \&:\&? Ar true_string Cm \&: Ar false_string
1198.Sm on 1198.Sm on
1199If the variable name (not its value), when parsed as a .if conditional 1199If the variable name (not its value), when parsed as a .if conditional
1200expression, evaluates to true, return as its value the 1200expression, evaluates to true, return as its value the
1201.Ar true_string , 1201.Ar true_string ,
1202otherwise return the 1202otherwise return the
1203.Ar false_string . 1203.Ar false_string .
1204Since the variable name is used as the expression, \&:\&? must be the 1204Since the variable name is used as the expression, \&:\&? must be the
1205first modifier after the variable name itself - which will, of course, 1205first modifier after the variable name itself - which will, of course,
1206usually contain variable expansions. 1206usually contain variable expansions.
1207A common error is trying to use expressions like 1207A common error is trying to use expressions like
1208.Dl ${NUMBERS:M42:?match:no} 1208.Dl ${NUMBERS:M42:?match:no}
1209which actually tests defined(NUMBERS), 1209which actually tests defined(NUMBERS),
1210to determine is any words match "42" you need to use something like: 1210to determine is any words match "42" you need to use something like:
1211.Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} . 1211.Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} .
1212.It Ar :old_string=new_string 1212.It Ar :old_string=new_string
1213This is the 1213This is the
1214.At V 1214.At V
1215style variable substitution. 1215style variable substitution.
1216It must be the last modifier specified. 1216It must be the last modifier specified.
1217If 1217If
1218.Ar old_string 1218.Ar old_string
1219or 1219or
1220.Ar new_string 1220.Ar new_string
1221do not contain the pattern matching character 1221do not contain the pattern matching character
1222.Ar % 1222.Ar %
1223then it is assumed that they are 1223then it is assumed that they are
1224anchored at the end of each word, so only suffixes or entire 1224anchored at the end of each word, so only suffixes or entire
1225words may be replaced. 1225words may be replaced.
1226Otherwise 1226Otherwise
1227.Ar % 1227.Ar %
1228is the substring of 1228is the substring of
1229.Ar old_string 1229.Ar old_string
1230to be replaced in 1230to be replaced in
1231.Ar new_string . 1231.Ar new_string .
1232.Pp 1232.Pp
1233Variable expansion occurs in the normal fashion inside both 1233Variable expansion occurs in the normal fashion inside both
1234.Ar old_string 1234.Ar old_string
1235and 1235and
1236.Ar new_string 1236.Ar new_string
1237with the single exception that a backslash is used to prevent the 1237with the single exception that a backslash is used to prevent the
1238expansion of a dollar sign 1238expansion of a dollar sign
1239.Pq Ql \&$ , 1239.Pq Ql \&$ ,
1240not a preceding dollar sign as is usual. 1240not a preceding dollar sign as is usual.
1241.Sm off 1241.Sm off
1242.It Cm \&:@ Ar temp Cm @ Ar string Cm @ 1242.It Cm \&:@ Ar temp Cm @ Ar string Cm @
1243.Sm on 1243.Sm on
1244This is the loop expansion mechanism from the OSF Development 1244This is the loop expansion mechanism from the OSF Development
1245Environment (ODE) make. 1245Environment (ODE) make.
1246Unlike 1246Unlike
1247.Cm \&.for 1247.Cm \&.for
1248loops expansion occurs at the time of 1248loops expansion occurs at the time of
1249reference. 1249reference.
1250Assign 1250Assign
1251.Ar temp 1251.Ar temp
1252to each word in the variable and evaluate 1252to each word in the variable and evaluate
1253.Ar string . 1253.Ar string .
1254The ODE convention is that 1254The ODE convention is that
1255.Ar temp 1255.Ar temp
1256should start and end with a period. 1256should start and end with a period.
1257For example. 1257For example.
1258.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 1258.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
 1259.Pp
 1260However a single character varaiable is often more readable:
 1261.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
1259.It Cm \&:U Ns Ar newval 1262.It Cm \&:U Ns Ar newval
1260If the variable is undefined 1263If the variable is undefined
1261.Ar newval 1264.Ar newval
1262is the value. 1265is the value.
1263If the variable is defined, the existing value is returned. 1266If the variable is defined, the existing value is returned.
1264This is another ODE make feature. 1267This is another ODE make feature.
1265It is handy for setting per-target CFLAGS for instance: 1268It is handy for setting per-target CFLAGS for instance:
1266.Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 1269.Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}}
1267If a value is only required if the variable is undefined, use: 1270If a value is only required if the variable is undefined, use:
1268.Dl ${VAR:D:Unewval} 1271.Dl ${VAR:D:Unewval}
1269.It Cm \&:D Ns Ar newval 1272.It Cm \&:D Ns Ar newval
1270If the variable is defined 1273If the variable is defined
1271.Ar newval 1274.Ar newval
1272is the value. 1275is the value.
1273.It Cm \&:L 1276.It Cm \&:L
1274The name of the variable is the value. 1277The name of the variable is the value.
1275.It Cm \&:P 1278.It Cm \&:P
1276The path of the node which has the same name as the variable 1279The path of the node which has the same name as the variable
1277is the value. 1280is the value.
1278If no such node exists or its path is null, then the 1281If no such node exists or its path is null, then the
1279name of the variable is used. 1282name of the variable is used.
1280.Sm off 1283.Sm off
1281.It Cm \&:\&! Ar cmd Cm \&! 1284.It Cm \&:\&! Ar cmd Cm \&!
1282.Sm on 1285.Sm on
1283The output of running 1286The output of running
1284.Ar cmd 1287.Ar cmd
1285is the value. 1288is the value.
1286.It Cm \&:sh 1289.It Cm \&:sh
1287If the variable is non-empty it is run as a command and the output 1290If the variable is non-empty it is run as a command and the output
1288becomes the new value. 1291becomes the new value.
1289.It Cm \&::= Ns Ar str 1292.It Cm \&::= Ns Ar str
1290The variable is assigned the value 1293The variable is assigned the value
1291.Ar str 1294.Ar str
1292after substitution. 1295after substitution.
1293This modifier and its variations are useful in 1296This modifier and its variations are useful in
1294obscure situations such as wanting to set a variable when shell commands 1297obscure situations such as wanting to set a variable when shell commands
1295are being parsed. 1298are being parsed.
1296These assignment modifiers always expand to 1299These assignment modifiers always expand to
1297nothing, so if appearing in a rule line by themselves should be 1300nothing, so if appearing in a rule line by themselves should be
1298preceded with something to keep 1301preceded with something to keep
1299.Nm 1302.Nm
1300happy. 1303happy.
1301.Pp 1304.Pp
1302The 1305The
1303.Ql Cm \&:: 1306.Ql Cm \&::
1304helps avoid false matches with the 1307helps avoid false matches with the
1305.At V 1308.At V
1306style 1309style
1307.Cm \&:= 1310.Cm \&:=
1308modifier and since substitution always occurs the 1311modifier and since substitution always occurs the
1309.Cm \&::= 1312.Cm \&::=
1310form is vaguely appropriate. 1313form is vaguely appropriate.
1311.It Cm \&::?= Ns Ar str 1314.It Cm \&::?= Ns Ar str
1312As for 1315As for
1313.Cm \&::= 1316.Cm \&::=
1314but only if the variable does not already have a value. 1317but only if the variable does not already have a value.
1315.It Cm \&::+= Ns Ar str 1318.It Cm \&::+= Ns Ar str
1316Append 1319Append
1317.Ar str 1320.Ar str
1318to the variable. 1321to the variable.
1319.It Cm \&::!= Ns Ar cmd 1322.It Cm \&::!= Ns Ar cmd
1320Assign the output of 1323Assign the output of
1321.Ar cmd 1324.Ar cmd
1322to the variable. 1325to the variable.
1323.It Cm \&:\&[ Ns Ar range Ns Cm \&] 1326.It Cm \&:\&[ Ns Ar range Ns Cm \&]
1324Selects one or more words from the value, 1327Selects one or more words from the value,
1325or performs other operations related to the way in which the 1328or performs other operations related to the way in which the
1326value is divided into words. 1329value is divided into words.
1327.Pp 1330.Pp
1328Ordinarily, a value is treated as a sequence of words 1331Ordinarily, a value is treated as a sequence of words
1329delimited by white space. 1332delimited by white space.
1330Some modifiers suppress this behaviour, 1333Some modifiers suppress this behaviour,
1331causing a value to be treated as a single word 1334causing a value to be treated as a single word
1332(possibly containing embedded white space). 1335(possibly containing embedded white space).
1333An empty value, or a value that consists entirely of white-space, 1336An empty value, or a value that consists entirely of white-space,
1334is treated as a single word. 1337is treated as a single word.
1335For the purposes of the 1338For the purposes of the
1336.Ql Cm \&:[] 1339.Ql Cm \&:[]
1337modifier, the words are indexed both forwards using positive integers 1340modifier, the words are indexed both forwards using positive integers
1338(where index 1 represents the first word), 1341(where index 1 represents the first word),
1339and backwards using negative integers 1342and backwards using negative integers
1340(where index \-1 represents the last word). 1343(where index \-1 represents the last word).
1341.Pp 1344.Pp
1342The 1345The
1343.Ar range 1346.Ar range
1344is subjected to variable expansion, and the expanded result is 1347is subjected to variable expansion, and the expanded result is
1345then interpreted as follows: 1348then interpreted as follows:
1346.Bl -tag -width index 1349.Bl -tag -width index
1347.\" :[n] 1350.\" :[n]
1348.It Ar index 1351.It Ar index
1349Selects a single word from the value. 1352Selects a single word from the value.
1350.\" :[start..end] 1353.\" :[start..end]
1351.It Ar start Ns Cm \&.. Ns Ar end 1354.It Ar start Ns Cm \&.. Ns Ar end
1352Selects all words from 1355Selects all words from
1353.Ar start 1356.Ar start
1354to 1357to
1355.Ar end , 1358.Ar end ,
1356inclusive. 1359inclusive.
1357For example, 1360For example,
1358.Ql Cm \&:[2..-1] 1361.Ql Cm \&:[2..-1]
1359selects all words from the second word to the last word. 1362selects all words from the second word to the last word.
1360If 1363If
1361.Ar start 1364.Ar start
1362is greater than 1365is greater than
1363.Ar end , 1366.Ar end ,
1364then the words are output in reverse order. 1367then the words are output in reverse order.
1365For example, 1368For example,
1366.Ql Cm \&:[-1..1] 1369.Ql Cm \&:[-1..1]
1367selects all the words from last to first. 1370selects all the words from last to first.
1368.\" :[*] 1371.\" :[*]
1369.It Cm \&* 1372.It Cm \&*
1370Causes subsequent modifiers to treat the value as a single word 1373Causes subsequent modifiers to treat the value as a single word
1371(possibly containing embedded white space). 1374(possibly containing embedded white space).
1372Analogous to the effect of 1375Analogous to the effect of
1373\&"$*\&" 1376\&"$*\&"
1374in Bourne shell. 1377in Bourne shell.
1375.\" :[0] 1378.\" :[0]
1376.It 0 1379.It 0
1377Means the same as 1380Means the same as
1378.Ql Cm \&:[*] . 1381.Ql Cm \&:[*] .
1379.\" :[*] 1382.\" :[*]
1380.It Cm \&@ 1383.It Cm \&@
1381Causes subsequent modifiers to treat the value as a sequence of words 1384Causes subsequent modifiers to treat the value as a sequence of words
1382delimited by white space. 1385delimited by white space.
1383Analogous to the effect of 1386Analogous to the effect of
1384\&"$@\&" 1387\&"$@\&"
1385in Bourne shell. 1388in Bourne shell.
1386.\" :[#] 1389.\" :[#]
1387.It Cm \&# 1390.It Cm \&#
1388Returns the number of words in the value. 1391Returns the number of words in the value.
1389.El \" :[range] 1392.El \" :[range]
1390.El 1393.El
1391.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS 1394.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS
1392Makefile inclusion, conditional structures and for loops reminiscent 1395Makefile inclusion, conditional structures and for loops reminiscent
1393of the C programming language are provided in 1396of the C programming language are provided in
1394.Nm . 1397.Nm .
1395All such structures are identified by a line beginning with a single 1398All such structures are identified by a line beginning with a single
1396dot 1399dot
1397.Pq Ql \&. 1400.Pq Ql \&.
1398character. 1401character.
1399Files are included with either 1402Files are included with either
1400.Cm \&.include Aq Ar file 1403.Cm \&.include Aq Ar file
1401or 1404or
1402.Cm \&.include Pf \*q Ar file Ns \*q . 1405.Cm \&.include Pf \*q Ar file Ns \*q .
1403Variables between the angle brackets or double quotes are expanded 1406Variables between the angle brackets or double quotes are expanded
1404to form the file name. 1407to form the file name.
1405If angle brackets are used, the included makefile is expected to be in 1408If angle brackets are used, the included makefile is expected to be in
1406the system makefile directory. 1409the system makefile directory.
1407If double quotes are used, the including makefile's directory and any 1410If double quotes are used, the including makefile's directory and any
1408directories specified using the 1411directories specified using the
1409.Fl I 1412.Fl I
1410option are searched before the system 1413option are searched before the system
1411makefile directory. 1414makefile directory.
1412For compatibility with other versions of 1415For compatibility with other versions of
1413.Nm 1416.Nm
1414.Ql include file ... 1417.Ql include file ...
1415is also accepted. 1418is also accepted.
1416If the include statement is written as 1419If the include statement is written as
1417.Cm .-include 1420.Cm .-include
1418or as 1421or as
1419.Cm .sinclude 1422.Cm .sinclude
1420then errors locating and/or opening include files are ignored. 1423then errors locating and/or opening include files are ignored.
1421.Pp 1424.Pp
1422Conditional expressions are also preceded by a single dot as the first 1425Conditional expressions are also preceded by a single dot as the first
1423character of a line. 1426character of a line.
1424The possible conditionals are as follows: 1427The possible conditionals are as follows:
1425.Bl -tag -width Ds 1428.Bl -tag -width Ds
1426.It Ic .error Ar message 1429.It Ic .error Ar message
1427The message is printed along with the name of the makefile and line number, 1430The message is printed along with the name of the makefile and line number,
1428then 1431then
1429.Nm 1432.Nm
1430will exit. 1433will exit.
1431.It Ic .export Ar variable ... 1434.It Ic .export Ar variable ...
1432Export the specified global variable. 1435Export the specified global variable.
1433If no variable list is provided, all globals are exported 1436If no variable list is provided, all globals are exported
1434except for internal variables (those that start with 1437except for internal variables (those that start with
1435.Ql \&. ) . 1438.Ql \&. ) .
1436This is not affected by the 1439This is not affected by the
1437.Fl X 1440.Fl X
1438flag, so should be used with caution. 1441flag, so should be used with caution.
1439.Pp 1442.Pp
1440Appending a variable name to 1443Appending a variable name to
1441.Va .MAKE.EXPORTED 1444.Va .MAKE.EXPORTED
1442is equivalent to exporting a variable. 1445is equivalent to exporting a variable.
1443.It Ic .export-env Ar variable ... 1446.It Ic .export-env Ar variable ...
1444The same as 1447The same as
1445.Ql .export , 1448.Ql .export ,
1446except that the variable is not appended to 1449except that the variable is not appended to
1447.Va .MAKE.EXPORTED . 1450.Va .MAKE.EXPORTED .
1448This allows exporting a value to the environment which is different from that 1451This allows exporting a value to the environment which is different from that
1449used by 1452used by
1450.Nm 1453.Nm
1451internally. 1454internally.
1452.It Ic .info Ar message 1455.It Ic .info Ar message
1453The message is printed along with the name of the makefile and line number. 1456The message is printed along with the name of the makefile and line number.
1454.It Ic .undef Ar variable 1457.It Ic .undef Ar variable
1455Un-define the specified global variable. 1458Un-define the specified global variable.
1456Only global variables may be un-defined. 1459Only global variables may be un-defined.
1457.It Ic .unexport Ar variable ... 1460.It Ic .unexport Ar variable ...
1458The opposite of 1461The opposite of
1459.Ql .export . 1462.Ql .export .
1460The specified global 1463The specified global
1461.Va variable 1464.Va variable
1462will be removed from 1465will be removed from
1463.Va .MAKE.EXPORTED . 1466.Va .MAKE.EXPORTED .
1464If no variable list is provided, all globals are unexported, 1467If no variable list is provided, all globals are unexported,
1465and 1468and
1466.Va .MAKE.EXPORTED 1469.Va .MAKE.EXPORTED
1467deleted. 1470deleted.
1468.It Ic .unexport-env 1471.It Ic .unexport-env
1469Unexport all globals previously exported and 1472Unexport all globals previously exported and
1470clear the environment inherited from the parent. 1473clear the environment inherited from the parent.
1471This operation will cause a memory leak of the original environment, 1474This operation will cause a memory leak of the original environment,
1472so should be used sparingly. 1475so should be used sparingly.
1473Testing for 1476Testing for
1474.Va .MAKE.LEVEL 1477.Va .MAKE.LEVEL
1475being 0, would make sense. 1478being 0, would make sense.
1476Also note that any variables which originated in the parent environment 1479Also note that any variables which originated in the parent environment
1477should be explicitly preserved if desired. 1480should be explicitly preserved if desired.
1478For example: 1481For example:
1479.Bd -literal -offset indent 1482.Bd -literal -offset indent
1480.Li .if ${.MAKE.LEVEL} == 0 1483.Li .if ${.MAKE.LEVEL} == 0
1481PATH := ${PATH} 1484PATH := ${PATH}
1482.Li .unexport-env 1485.Li .unexport-env
1483.Li .export PATH 1486.Li .export PATH
1484.Li .endif 1487.Li .endif
1485.Pp 1488.Pp
1486.Ed 1489.Ed
1487Would result in an environment containing only 1490Would result in an environment containing only
1488.Ql Ev PATH , 1491.Ql Ev PATH ,
1489which is the minimal useful environment. 1492which is the minimal useful environment.
1490Actually 1493Actually
1491.Ql Ev .MAKE.LEVEL 1494.Ql Ev .MAKE.LEVEL
1492will also be pushed into the new environment. 1495will also be pushed into the new environment.
1493.It Ic .warning Ar message 1496.It Ic .warning Ar message
1494The message prefixed by 1497The message prefixed by
1495.Ql Pa warning: 1498.Ql Pa warning:
1496is printed along with the name of the makefile and line number. 1499is printed along with the name of the makefile and line number.
1497.It Ic \&.if Oo \&! Oc Ns Ar expression Op Ar operator expression ... 1500.It Ic \&.if Oo \&! Oc Ns Ar expression Op Ar operator expression ...
1498Test the value of an expression. 1501Test the value of an expression.
1499.It Ic .ifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 1502.It Ic .ifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
1500Test the value of a variable. 1503Test the value of a variable.
1501.It Ic .ifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 1504.It Ic .ifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
1502Test the value of a variable. 1505Test the value of a variable.
1503.It Ic .ifmake Oo \&! Oc Ns Ar target Op Ar operator target ... 1506.It Ic .ifmake Oo \&! Oc Ns Ar target Op Ar operator target ...
1504Test the target being built. 1507Test the target being built.
1505.It Ic .ifnmake Oo \&! Ns Oc Ar target Op Ar operator target ... 1508.It Ic .ifnmake Oo \&! Ns Oc Ar target Op Ar operator target ...
1506Test the target being built. 1509Test the target being built.
1507.It Ic .else 1510.It Ic .else
1508Reverse the sense of the last conditional. 1511Reverse the sense of the last conditional.
1509.It Ic .elif Oo \&! Ns Oc Ar expression Op Ar operator expression ... 1512.It Ic .elif Oo \&! Ns Oc Ar expression Op Ar operator expression ...
1510A combination of 1513A combination of
1511.Ql Ic .else 1514.Ql Ic .else
1512followed by 1515followed by
1513.Ql Ic .if . 1516.Ql Ic .if .
1514.It Ic .elifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 1517.It Ic .elifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
1515A combination of 1518A combination of
1516.Ql Ic .else 1519.Ql Ic .else
1517followed by 1520followed by
1518.Ql Ic .ifdef . 1521.Ql Ic .ifdef .
1519.It Ic .elifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... 1522.It Ic .elifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ...
1520A combination of 1523A combination of
1521.Ql Ic .else 1524.Ql Ic .else
1522followed by 1525followed by
1523.Ql Ic .ifndef . 1526.Ql Ic .ifndef .
1524.It Ic .elifmake Oo \&! Oc Ns Ar target Op Ar operator target ... 1527.It Ic .elifmake Oo \&! Oc Ns Ar target Op Ar operator target ...
1525A combination of 1528A combination of
1526.Ql Ic .else 1529.Ql Ic .else
1527followed by 1530followed by
1528.Ql Ic .ifmake . 1531.Ql Ic .ifmake .
1529.It Ic .elifnmake Oo \&! Oc Ns Ar target Op Ar operator target ... 1532.It Ic .elifnmake Oo \&! Oc Ns Ar target Op Ar operator target ...
1530A combination of 1533A combination of
1531.Ql Ic .else 1534.Ql Ic .else
1532followed by 1535followed by
1533.Ql Ic .ifnmake . 1536.Ql Ic .ifnmake .
1534.It Ic .endif 1537.It Ic .endif
1535End the body of the conditional. 1538End the body of the conditional.
1536.El 1539.El
1537.Pp 1540.Pp
1538The 1541The
1539.Ar operator 1542.Ar operator
1540may be any one of the following: 1543may be any one of the following:
1541.Bl -tag -width "Cm XX" 1544.Bl -tag -width "Cm XX"
1542.It Cm \&|\&| 1545.It Cm \&|\&|
1543Logical OR. 1546Logical OR.
1544.It Cm \&\*[Am]\*[Am] 1547.It Cm \&\*[Am]\*[Am]
1545Logical 1548Logical
1546.Tn AND ; 1549.Tn AND ;
1547of higher precedence than 1550of higher precedence than
1548.Dq \&|\&| . 1551.Dq \&|\&| .
1549.El 1552.El
1550.Pp 1553.Pp
1551As in C, 1554As in C,
1552.Nm 1555.Nm
1553will only evaluate a conditional as far as is necessary to determine 1556will only evaluate a conditional as far as is necessary to determine
1554its value. 1557its value.
1555Parentheses may be used to change the order of evaluation. 1558Parentheses may be used to change the order of evaluation.
1556The boolean operator 1559The boolean operator
1557.Ql Ic \&! 1560.Ql Ic \&!
1558may be used to logically negate an entire 1561may be used to logically negate an entire
1559conditional. 1562conditional.
1560It is of higher precedence than 1563It is of higher precedence than
1561.Ql Ic \&\*[Am]\*[Am] . 1564.Ql Ic \&\*[Am]\*[Am] .
1562.Pp 1565.Pp
1563The value of 1566The value of
1564.Ar expression 1567.Ar expression
1565may be any of the following: 1568may be any of the following:
1566.Bl -tag -width defined 1569.Bl -tag -width defined
1567.It Ic defined 1570.It Ic defined
1568Takes a variable name as an argument and evaluates to true if the variable 1571Takes a variable name as an argument and evaluates to true if the variable
1569has been defined. 1572has been defined.
1570.It Ic make 1573.It Ic make
1571Takes a target name as an argument and evaluates to true if the target 1574Takes a target name as an argument and evaluates to true if the target
1572was specified as part of 1575was specified as part of
1573.Nm Ns 's 1576.Nm Ns 's
1574command line or was declared the default target (either implicitly or 1577command line or was declared the default target (either implicitly or
1575explicitly, see 1578explicitly, see
1576.Va .MAIN ) 1579.Va .MAIN )
1577before the line containing the conditional. 1580before the line containing the conditional.
1578.It Ic empty 1581.It Ic empty
1579Takes a variable, with possible modifiers, and evaluates to true if 1582Takes a variable, with possible modifiers, and evaluates to true if
1580the expansion of the variable would result in an empty string. 1583the expansion of the variable would result in an empty string.
1581.It Ic exists 1584.It Ic exists
1582Takes a file name as an argument and evaluates to true if the file exists. 1585Takes a file name as an argument and evaluates to true if the file exists.
1583The file is searched for on the system search path (see 1586The file is searched for on the system search path (see
1584.Va .PATH ) . 1587.Va .PATH ) .
1585.It Ic target 1588.It Ic target
1586Takes a target name as an argument and evaluates to true if the target 1589Takes a target name as an argument and evaluates to true if the target
1587has been defined. 1590has been defined.
1588.It Ic commands 1591.It Ic commands
1589Takes a target name as an argument and evaluates to true if the target 1592Takes a target name as an argument and evaluates to true if the target
1590has been defined and has commands associated with it. 1593has been defined and has commands associated with it.
1591.El 1594.El
1592.Pp 1595.Pp
1593.Ar Expression 1596.Ar Expression
1594may also be an arithmetic or string comparison. 1597may also be an arithmetic or string comparison.
1595Variable expansion is 1598Variable expansion is
1596performed on both sides of the comparison, after which the integral 1599performed on both sides of the comparison, after which the integral
1597values are compared. 1600values are compared.
1598A value is interpreted as hexadecimal if it is 1601A value is interpreted as hexadecimal if it is
1599preceded by 0x, otherwise it is decimal; octal numbers are not supported. 1602preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1600The standard C relational operators are all supported. 1603The standard C relational operators are all supported.
1601If after 1604If after
1602variable expansion, either the left or right hand side of a 1605variable expansion, either the left or right hand side of a
1603.Ql Ic == 1606.Ql Ic ==
1604or 1607or
1605.Ql Ic "!=" 1608.Ql Ic "!="
1606operator is not an integral value, then 1609operator is not an integral value, then
1607string comparison is performed between the expanded 1610string comparison is performed between the expanded
1608variables. 1611variables.
1609If no relational operator is given, it is assumed that the expanded 1612If no relational operator is given, it is assumed that the expanded
1610variable is being compared against 0 or an empty string in the case 1613variable is being compared against 0 or an empty string in the case
1611of a string comparison. 1614of a string comparison.
1612.Pp 1615.Pp
1613When 1616When
1614.Nm 1617.Nm
1615is evaluating one of these conditional expressions, and it encounters 1618is evaluating one of these conditional expressions, and it encounters
1616a (white-space separated) word it doesn't recognize, either the 1619a (white-space separated) word it doesn't recognize, either the
1617.Dq make 1620.Dq make
1618or 1621or
1619.Dq defined 1622.Dq defined
1620expression is applied to it, depending on the form of the conditional. 1623expression is applied to it, depending on the form of the conditional.
1621If the form is 1624If the form is
1622.Ql Ic .ifdef , 1625.Ql Ic .ifdef ,
1623.Ql Ic .ifndef , 1626.Ql Ic .ifndef ,
1624or 1627or
1625.Ql Ic .if 1628.Ql Ic .if
1626the 1629the
1627.Dq defined 1630.Dq defined
1628expression is applied. 1631expression is applied.
1629Similarly, if the form is 1632Similarly, if the form is
1630.Ql Ic .ifmake 1633.Ql Ic .ifmake
1631or 1634or
1632.Ql Ic .ifnmake , the 1635.Ql Ic .ifnmake , the
1633.Dq make 1636.Dq make
1634expression is applied. 1637expression is applied.
1635.Pp 1638.Pp
1636If the conditional evaluates to true the parsing of the makefile continues 1639If the conditional evaluates to true the parsing of the makefile continues
1637as before. 1640as before.
1638If it evaluates to false, the following lines are skipped. 1641If it evaluates to false, the following lines are skipped.
1639In both cases this continues until a 1642In both cases this continues until a
1640.Ql Ic .else 1643.Ql Ic .else
1641or 1644or
1642.Ql Ic .endif 1645.Ql Ic .endif
1643is found. 1646is found.
1644.Pp 1647.Pp
1645For loops are typically used to apply a set of rules to a list of files. 1648For loops are typically used to apply a set of rules to a list of files.
1646The syntax of a for loop is: 1649The syntax of a for loop is:
1647.Pp 1650.Pp
1648.Bl -tag -compact -width Ds 1651.Bl -tag -compact -width Ds
1649.It Ic \&.for Ar variable Oo Ar variable ... Oc Ic in Ar expression 1652.It Ic \&.for Ar variable Oo Ar variable ... Oc Ic in Ar expression
1650.It Aq make-rules 1653.It Aq make-rules
1651.It Ic \&.endfor 1654.It Ic \&.endfor
1652.El 1655.El
1653.Pp 1656.Pp
1654After the for 1657After the for
1655.Ic expression 1658.Ic expression
1656is evaluated, it is split into words. 1659is evaluated, it is split into words.
1657On each iteration of the loop, one word is taken and assigned to each 1660On each iteration of the loop, one word is taken and assigned to each
1658.Ic variable , 1661.Ic variable ,
1659in order, and these 1662in order, and these
1660.Ic variables 1663.Ic variables
1661are substituted into the 1664are substituted into the
1662.Ic make-rules 1665.Ic make-rules
1663inside the body of the for loop. 1666inside the body of the for loop.
1664The number of words must come out even; that is, if there are three 1667The number of words must come out even; that is, if there are three
1665iteration variables, the number of words provided must be a multiple 1668iteration variables, the number of words provided must be a multiple
1666of three. 1669of three.
1667.Sh COMMENTS 1670.Sh COMMENTS
1668Comments begin with a hash 1671Comments begin with a hash
1669.Pq Ql \&# 1672.Pq Ql \&#
1670character, anywhere but in a shell 1673character, anywhere but in a shell
1671command line, and continue to the end of an unescaped new line. 1674command line, and continue to the end of an unescaped new line.
1672.Sh SPECIAL SOURCES (ATTRIBUTES) 1675.Sh SPECIAL SOURCES (ATTRIBUTES)
1673.Bl -tag -width .IGNOREx 1676.Bl -tag -width .IGNOREx
1674.It Ic .EXEC 1677.It Ic .EXEC
1675Target is never out of date, but always execute commands anyway. 1678Target is never out of date, but always execute commands anyway.
1676.It Ic .IGNORE 1679.It Ic .IGNORE
1677Ignore any errors from the commands associated with this target, exactly 1680Ignore any errors from the commands associated with this target, exactly
1678as if they all were preceded by a dash 1681as if they all were preceded by a dash
1679.Pq Ql \- . 1682.Pq Ql \- .
1680.\" .It Ic .INVISIBLE 1683.\" .It Ic .INVISIBLE
1681.\" XXX 1684.\" XXX
1682.\" .It Ic .JOIN 1685.\" .It Ic .JOIN
1683.\" XXX 1686.\" XXX
1684.It Ic .MADE 1687.It Ic .MADE
1685Mark all sources of this target as being up-to-date. 1688Mark all sources of this target as being up-to-date.
1686.It Ic .MAKE 1689.It Ic .MAKE
1687Execute the commands associated with this target even if the 1690Execute the commands associated with this target even if the
1688.Fl n 1691.Fl n
1689or 1692or
1690.Fl t 1693.Fl t
1691options were specified. 1694options were specified.
1692Normally used to mark recursive 1695Normally used to mark recursive
1693.Nm Ns 's . 1696.Nm Ns 's .
1694.It Ic .META 1697.It Ic .META
1695Create a meta file for the target, even if it is flagged as 1698Create a meta file for the target, even if it is flagged as
1696.Ic .PHONY , 1699.Ic .PHONY ,
1697.Ic .MAKE , 1700.Ic .MAKE ,
1698or 1701or
1699.Ic .SPECIAL . 1702.Ic .SPECIAL .
1700Usage in conjunction with 1703Usage in conjunction with
1701.Ic .MAKE 1704.Ic .MAKE
1702is the most likely case. 1705is the most likely case.
1703In "meta" mode, the target is out-of-date if the meta file is missing. 1706In "meta" mode, the target is out-of-date if the meta file is missing.
1704.It Ic .NOMETA 1707.It Ic .NOMETA
1705Do not create a meta file for the target. 1708Do not create a meta file for the target.
1706Meta files are also not created for 1709Meta files are also not created for
1707.Ic .PHONY , 1710.Ic .PHONY ,
1708.Ic .MAKE , 1711.Ic .MAKE ,
1709or 1712or
1710.Ic .SPECIAL 1713.Ic .SPECIAL
1711targets. 1714targets.
1712.It Ic .NOMETA_CMP 1715.It Ic .NOMETA_CMP
1713Ignore differences in commands when deciding if target is out of date. 1716Ignore differences in commands when deciding if target is out of date.
1714This is useful if the command contains a value which always changes. 1717This is useful if the command contains a value which always changes.
1715If the number of commands change, though, the target will still be out of date. 1718If the number of commands change, though, the target will still be out of date.
1716.It Ic .NOPATH 1719.It Ic .NOPATH
1717Do not search for the target in the directories specified by 1720Do not search for the target in the directories specified by
1718.Ic .PATH . 1721.Ic .PATH .
1719.It Ic .NOTMAIN 1722.It Ic .NOTMAIN
1720Normally 1723Normally
1721.Nm 1724.Nm
1722selects the first target it encounters as the default target to be built 1725selects the first target it encounters as the default target to be built
1723if no target was specified. 1726if no target was specified.
1724This source prevents this target from being selected. 1727This source prevents this target from being selected.
1725.It Ic .OPTIONAL 1728.It Ic .OPTIONAL
1726If a target is marked with this attribute and 1729If a target is marked with this attribute and
1727.Nm 1730.Nm
1728can't figure out how to create it, it will ignore this fact and assume 1731can't figure out how to create it, it will ignore this fact and assume
1729the file isn't needed or already exists. 1732the file isn't needed or already exists.
1730.It Ic .PHONY 1733.It Ic .PHONY
1731The target does not 1734The target does not
1732correspond to an actual file; it is always considered to be out of date, 1735correspond to an actual file; it is always considered to be out of date,
1733and will not be created with the 1736and will not be created with the
1734.Fl t 1737.Fl t
1735option. 1738option.
1736Suffix-transformation rules are not applied to 1739Suffix-transformation rules are not applied to
1737.Ic .PHONY 1740.Ic .PHONY
1738targets. 1741targets.
1739.It Ic .PRECIOUS 1742.It Ic .PRECIOUS
1740When 1743When
1741.Nm 1744.Nm
1742is interrupted, it normally removes any partially made targets. 1745is interrupted, it normally removes any partially made targets.
1743This source prevents the target from being removed. 1746This source prevents the target from being removed.
1744.It Ic .RECURSIVE 1747.It Ic .RECURSIVE
1745Synonym for 1748Synonym for
1746.Ic .MAKE . 1749.Ic .MAKE .
1747.It Ic .SILENT 1750.It Ic .SILENT
1748Do not echo any of the commands associated with this target, exactly 1751Do not echo any of the commands associated with this target, exactly
1749as if they all were preceded by an at sign 1752as if they all were preceded by an at sign
1750.Pq Ql @ . 1753.Pq Ql @ .
1751.It Ic .USE 1754.It Ic .USE
1752Turn the target into 1755Turn the target into
1753.Nm Ns 's 1756.Nm Ns 's
1754version of a macro. 1757version of a macro.
1755When the target is used as a source for another target, the other target 1758When the target is used as a source for another target, the other target
1756acquires the commands, sources, and attributes (except for 1759acquires the commands, sources, and attributes (except for
1757.Ic .USE ) 1760.Ic .USE )
1758of the 1761of the
1759source. 1762source.
1760If the target already has commands, the 1763If the target already has commands, the
1761.Ic .USE 1764.Ic .USE
1762target's commands are appended 1765target's commands are appended
1763to them. 1766to them.
1764.It Ic .USEBEFORE 1767.It Ic .USEBEFORE
1765Exactly like 1768Exactly like
1766.Ic .USE , 1769.Ic .USE ,
1767but prepend the 1770but prepend the
1768.Ic .USEBEFORE 1771.Ic .USEBEFORE
1769target commands to the target. 1772target commands to the target.
1770.It Ic .WAIT 1773.It Ic .WAIT
1771If 1774If
1772.Ic .WAIT 1775.Ic .WAIT
1773appears in a dependency line, the sources that precede it are 1776appears in a dependency line, the sources that precede it are
1774made before the sources that succeed it in the line. 1777made before the sources that succeed it in the line.
1775Since the dependents of files are not made until the file itself 1778Since the dependents of files are not made until the file itself
1776could be made, this also stops the dependents being built unless they 1779could be made, this also stops the dependents being built unless they
1777are needed for another branch of the dependency tree. 1780are needed for another branch of the dependency tree.
1778So given: 1781So given:
1779.Bd -literal 1782.Bd -literal
1780x: a .WAIT b 1783x: a .WAIT b
1781 echo x 1784 echo x
1782a: 1785a:
1783 echo a 1786 echo a
1784b: b1 1787b: b1
1785 echo b 1788 echo b
1786b1: 1789b1:
1787 echo b1 1790 echo b1
1788 1791
1789.Ed 1792.Ed
1790the output is always 1793the output is always
1791.Ql a , 1794.Ql a ,
1792.Ql b1 , 1795.Ql b1 ,
1793.Ql b , 1796.Ql b ,
1794.Ql x . 1797.Ql x .
1795.br 1798.br
1796The ordering imposed by 1799The ordering imposed by
1797.Ic .WAIT 1800.Ic .WAIT
1798is only relevant for parallel makes. 1801is only relevant for parallel makes.
1799.El 1802.El
1800.Sh SPECIAL TARGETS 1803.Sh SPECIAL TARGETS
1801Special targets may not be included with other targets, i.e. they must be 1804Special targets may not be included with other targets, i.e. they must be
1802the only target specified. 1805the only target specified.
1803.Bl -tag -width .BEGINx 1806.Bl -tag -width .BEGINx
1804.It Ic .BEGIN 1807.It Ic .BEGIN
1805Any command lines attached to this target are executed before anything 1808Any command lines attached to this target are executed before anything
1806else is done. 1809else is done.
1807.It Ic .DEFAULT 1810.It Ic .DEFAULT
1808This is sort of a 1811This is sort of a
1809.Ic .USE 1812.Ic .USE
1810rule for any target (that was used only as a 1813rule for any target (that was used only as a
1811source) that 1814source) that
1812.Nm 1815.Nm
1813can't figure out any other way to create. 1816can't figure out any other way to create.
1814Only the shell script is used. 1817Only the shell script is used.
1815The 1818The
1816.Ic .IMPSRC 1819.Ic .IMPSRC
1817variable of a target that inherits 1820variable of a target that inherits
1818.Ic .DEFAULT Ns 's 1821.Ic .DEFAULT Ns 's
1819commands is set 1822commands is set
1820to the target's own name. 1823to the target's own name.
1821.It Ic .END 1824.It Ic .END
1822Any command lines attached to this target are executed after everything 1825Any command lines attached to this target are executed after everything
1823else is done. 1826else is done.
1824.It Ic .ERROR 1827.It Ic .ERROR
1825Any command lines attached to this target are executed when another target fails. 1828Any command lines attached to this target are executed when another target fails.
1826The 1829The
1827.Ic .ERROR_TARGET 1830.Ic .ERROR_TARGET
1828variable is set to the target that failed. 1831variable is set to the target that failed.
1829See also 1832See also
1830.Ic MAKE_PRINT_VAR_ON_ERROR . 1833.Ic MAKE_PRINT_VAR_ON_ERROR .
1831.It Ic .IGNORE 1834.It Ic .IGNORE
1832Mark each of the sources with the 1835Mark each of the sources with the
1833.Ic .IGNORE 1836.Ic .IGNORE
1834attribute. 1837attribute.
1835If no sources are specified, this is the equivalent of specifying the 1838If no sources are specified, this is the equivalent of specifying the
1836.Fl i 1839.Fl i
1837option. 1840option.
1838.It Ic .INTERRUPT 1841.It Ic .INTERRUPT
1839If 1842If
1840.Nm 1843.Nm
1841is interrupted, the commands for this target will be executed. 1844is interrupted, the commands for this target will be executed.
1842.It Ic .MAIN 1845.It Ic .MAIN
1843If no target is specified when 1846If no target is specified when
1844.Nm 1847.Nm
1845is invoked, this target will be built. 1848is invoked, this target will be built.
1846.It Ic .MAKEFLAGS 1849.It Ic .MAKEFLAGS
1847This target provides a way to specify flags for 1850This target provides a way to specify flags for
1848.Nm 1851.Nm
1849when the makefile is used. 1852when the makefile is used.
1850The flags are as if typed to the shell, though the 1853The flags are as if typed to the shell, though the
1851.Fl f 1854.Fl f
1852option will have 1855option will have
1853no effect. 1856no effect.
1854.\" XXX: NOT YET!!!! 1857.\" XXX: NOT YET!!!!
1855.\" .It Ic .NOTPARALLEL 1858.\" .It Ic .NOTPARALLEL
1856.\" The named targets are executed in non parallel mode. 1859.\" The named targets are executed in non parallel mode.
1857.\" If no targets are 1860.\" If no targets are
1858.\" specified, then all targets are executed in non parallel mode. 1861.\" specified, then all targets are executed in non parallel mode.
1859.It Ic .NOPATH 1862.It Ic .NOPATH
1860Apply the 1863Apply the
1861.Ic .NOPATH 1864.Ic .NOPATH
1862attribute to any specified sources. 1865attribute to any specified sources.
1863.It Ic .NOTPARALLEL 1866.It Ic .NOTPARALLEL
1864Disable parallel mode. 1867Disable parallel mode.
1865.It Ic .NO_PARALLEL 1868.It Ic .NO_PARALLEL
1866Synonym for 1869Synonym for
1867.Ic .NOTPARALLEL , 1870.Ic .NOTPARALLEL ,
1868for compatibility with other pmake variants. 1871for compatibility with other pmake variants.
1869.It Ic .ORDER 1872.It Ic .ORDER
1870The named targets are made in sequence. 1873The named targets are made in sequence.
1871This ordering does not add targets to the list of targets to be made. 1874This ordering does not add targets to the list of targets to be made.
1872Since the dependents of a target do not get built until the target itself 1875Since the dependents of a target do not get built until the target itself
1873could be built, unless 1876could be built, unless
1874.Ql a 1877.Ql a
1875is built by another part of the dependency graph, 1878is built by another part of the dependency graph,
1876the following is a dependency loop: 1879the following is a dependency loop:
1877.Bd -literal 1880.Bd -literal
1878\&.ORDER: b a 1881\&.ORDER: b a
1879b: a 1882b: a
1880.Ed 1883.Ed
1881.Pp 1884.Pp
1882The ordering imposed by 1885The ordering imposed by
1883.Ic .ORDER 1886.Ic .ORDER
1884is only relevant for parallel makes. 1887is only relevant for parallel makes.
1885.\" XXX: NOT YET!!!! 1888.\" XXX: NOT YET!!!!
1886.\" .It Ic .PARALLEL 1889.\" .It Ic .PARALLEL
1887.\" The named targets are executed in parallel mode. 1890.\" The named targets are executed in parallel mode.
1888.\" If no targets are 1891.\" If no targets are
1889.\" specified, then all targets are executed in parallel mode. 1892.\" specified, then all targets are executed in parallel mode.
1890.It Ic .PATH 1893.It Ic .PATH
1891The sources are directories which are to be searched for files not 1894The sources are directories which are to be searched for files not
1892found in the current directory. 1895found in the current directory.
1893If no sources are specified, any previously specified directories are 1896If no sources are specified, any previously specified directories are
1894deleted. 1897deleted.
1895If the source is the special 1898If the source is the special
1896.Ic .DOTLAST 1899.Ic .DOTLAST
1897target, then the current working 1900target, then the current working
1898directory is searched last. 1901directory is searched last.
1899.It Ic .PHONY 1902.It Ic .PHONY
1900Apply the 1903Apply the
1901.Ic .PHONY 1904.Ic .PHONY
1902attribute to any specified sources. 1905attribute to any specified sources.
1903.It Ic .PRECIOUS 1906.It Ic .PRECIOUS
1904Apply the 1907Apply the
1905.Ic .PRECIOUS 1908.Ic .PRECIOUS
1906attribute to any specified sources. 1909attribute to any specified sources.
1907If no sources are specified, the 1910If no sources are specified, the
1908.Ic .PRECIOUS 1911.Ic .PRECIOUS
1909attribute is applied to every 1912attribute is applied to every
1910target in the file. 1913target in the file.
1911.It Ic .SHELL 1914.It Ic .SHELL
1912Sets the shell that 1915Sets the shell that
1913.Nm 1916.Nm
1914will use to execute commands. 1917will use to execute commands.
1915The sources are a set of 1918The sources are a set of
1916.Ar field=value 1919.Ar field=value
1917pairs. 1920pairs.
1918.Bl -tag -width hasErrCtls 1921.Bl -tag -width hasErrCtls
1919.It Ar name 1922.It Ar name
1920This is the minimal specification, used to select one of the builtin 1923This is the minimal specification, used to select one of the builtin
1921shell specs; 1924shell specs;
1922.Ar sh , 1925.Ar sh ,
1923.Ar ksh , 1926.Ar ksh ,
1924and 1927and
1925.Ar csh . 1928.Ar csh .
1926.It Ar path 1929.It Ar path
1927Specifies the path to the shell. 1930Specifies the path to the shell.
1928.It Ar hasErrCtl 1931.It Ar hasErrCtl
1929Indicates whether the shell supports exit on error. 1932Indicates whether the shell supports exit on error.
1930.It Ar check 1933.It Ar check
1931The command to turn on error checking. 1934The command to turn on error checking.
1932.It Ar ignore 1935.It Ar ignore
1933The command to disable error checking. 1936The command to disable error checking.
1934.It Ar echo 1937.It Ar echo
1935The command to turn on echoing of commands executed. 1938The command to turn on echoing of commands executed.
1936.It Ar quiet 1939.It Ar quiet
1937The command to turn off echoing of commands executed. 1940The command to turn off echoing of commands executed.
1938.It Ar filter 1941.It Ar filter
1939The output to filter after issuing the 1942The output to filter after issuing the
1940.Ar quiet 1943.Ar quiet
1941command. 1944command.
1942It is typically identical to 1945It is typically identical to
1943.Ar quiet . 1946.Ar quiet .
1944.It Ar errFlag 1947.It Ar errFlag
1945The flag to pass the shell to enable error checking. 1948The flag to pass the shell to enable error checking.
1946.It Ar echoFlag 1949.It Ar echoFlag
1947The flag to pass the shell to enable command echoing. 1950The flag to pass the shell to enable command echoing.
1948.It Ar newline 1951.It Ar newline
1949The string literal to pass the shell that results in a single newline 1952The string literal to pass the shell that results in a single newline
1950character when used outside of any quoting characters. 1953character when used outside of any quoting characters.
1951.El 1954.El
1952Example: 1955Example:
1953.Bd -literal 1956.Bd -literal
1954\&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \e 1957\&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \e
1955 check="set \-e" ignore="set +e" \e 1958 check="set \-e" ignore="set +e" \e
1956 echo="set \-v" quiet="set +v" filter="set +v" \e 1959 echo="set \-v" quiet="set +v" filter="set +v" \e
1957 echoFlag=v errFlag=e newline="'\en'" 1960 echoFlag=v errFlag=e newline="'\en'"
1958.Ed 1961.Ed
1959.It Ic .SILENT 1962.It Ic .SILENT
1960Apply the 1963Apply the
1961.Ic .SILENT 1964.Ic .SILENT
1962attribute to any specified sources. 1965attribute to any specified sources.
1963If no sources are specified, the 1966If no sources are specified, the
1964.Ic .SILENT 1967.Ic .SILENT
1965attribute is applied to every 1968attribute is applied to every
1966command in the file. 1969command in the file.
1967.It Ic .SUFFIXES 1970.It Ic .SUFFIXES
1968Each source specifies a suffix to 1971Each source specifies a suffix to
1969.Nm . 1972.Nm .
1970If no sources are specified, any previously specified suffixes are deleted. 1973If no sources are specified, any previously specified suffixes are deleted.
1971It allows the creation of suffix-transformation rules. 1974It allows the creation of suffix-transformation rules.
1972.Pp 1975.Pp
1973Example: 1976Example:
1974.Bd -literal 1977.Bd -literal
1975\&.SUFFIXES: .o 1978\&.SUFFIXES: .o
1976\&.c.o: 1979\&.c.o:
1977 cc \-o ${.TARGET} \-c ${.IMPSRC} 1980 cc \-o ${.TARGET} \-c ${.IMPSRC}
1978.Ed 1981.Ed
1979.El 1982.El
1980.Sh ENVIRONMENT 1983.Sh ENVIRONMENT
1981.Nm 1984.Nm
1982uses the following environment variables, if they exist: 1985uses the following environment variables, if they exist:
1983.Ev MACHINE , 1986.Ev MACHINE ,
1984.Ev MACHINE_ARCH , 1987.Ev MACHINE_ARCH ,
1985.Ev MAKE , 1988.Ev MAKE ,
1986.Ev MAKEFLAGS , 1989.Ev MAKEFLAGS ,
1987.Ev MAKEOBJDIR , 1990.Ev MAKEOBJDIR ,
1988.Ev MAKEOBJDIRPREFIX , 1991.Ev MAKEOBJDIRPREFIX ,
1989.Ev MAKESYSPATH , 1992.Ev MAKESYSPATH ,
1990.Ev PWD , 1993.Ev PWD ,
1991and 1994and
1992.Ev TMPDIR . 1995.Ev TMPDIR .
1993.Pp 1996.Pp
1994.Ev MAKEOBJDIRPREFIX 1997.Ev MAKEOBJDIRPREFIX
1995and 1998and
1996.Ev MAKEOBJDIR 1999.Ev MAKEOBJDIR
1997may only be set in the environment or on the command line to 2000may only be set in the environment or on the command line to
1998.Nm 2001.Nm
1999and not as makefile variables; 2002and not as makefile variables;
2000see the description of 2003see the description of
2001.Ql Va .OBJDIR 2004.Ql Va .OBJDIR
2002for more details. 2005for more details.
2003.Sh FILES 2006.Sh FILES
2004.Bl -tag -width /usr/share/mk -compact 2007.Bl -tag -width /usr/share/mk -compact
2005.It .depend 2008.It .depend
2006list of dependencies 2009list of dependencies
2007.It Makefile 2010.It Makefile
2008list of dependencies 2011list of dependencies
2009.It makefile 2012.It makefile
2010list of dependencies 2013list of dependencies
2011.It sys.mk 2014.It sys.mk
2012system makefile 2015system makefile
2013.It /usr/share/mk 2016.It /usr/share/mk
2014system makefile directory 2017system makefile directory
2015.El 2018.El
2016.Sh COMPATIBILITY 2019.Sh COMPATIBILITY
2017The basic make syntax is compatible between different versions of make, 2020The basic make syntax is compatible between different versions of make,
2018however the special variables, variable modifiers and conditionals are not. 2021however the special variables, variable modifiers and conditionals are not.
2019.Pp 2022.Pp
2020The way that parallel makes are scheduled changed in 2023The way that parallel makes are scheduled changed in
2021.Nx 4.0 2024.Nx 4.0
2022so that .ORDER and .WAIT apply recursively to the dependent nodes. 2025so that .ORDER and .WAIT apply recursively to the dependent nodes.
2023The algorithms used may change again in the future. 2026The algorithms used may change again in the future.
2024.Pp 2027.Pp
2025The way that .for loop variables are substituted changed after 2028The way that .for loop variables are substituted changed after
2026.Nx 5.0 2029.Nx 5.0
2027so that they still appear to be variable expansions. 2030so that they still appear to be variable expansions.
2028In particular this stops them being treated as syntax, and removes some 2031In particular this stops them being treated as syntax, and removes some
2029obscure problems using them in .if statements. 2032obscure problems using them in .if statements.
2030.Pp 2033.Pp
2031Unlike other 2034Unlike other
2032.Nm 2035.Nm
2033programs, this implementation by default executes all commands for a given 2036programs, this implementation by default executes all commands for a given
2034target using a single shell invocation. 2037target using a single shell invocation.
2035This is done for both efficiency and to simplify error handling in remote 2038This is done for both efficiency and to simplify error handling in remote
2036command invocations. 2039command invocations.
2037Typically this is transparent to the user, unless the target commands change 2040Typically this is transparent to the user, unless the target commands change
2038the current working directory using 2041the current working directory using
2039.Dq cd 2042.Dq cd
2040or 2043or
2041.Dq chdir . 2044.Dq chdir .
2042To be compatible with Makefiles that do this, one can use 2045To be compatible with Makefiles that do this, one can use
2043.Fl B 2046.Fl B
2044to disable this behavior. 2047to disable this behavior.
2045.Sh SEE ALSO 2048.Sh SEE ALSO
2046.Xr mkdep 1 2049.Xr mkdep 1
2047.Sh HISTORY 2050.Sh HISTORY
2048A 2051A
2049.Nm 2052.Nm
2050command appeared in 2053command appeared in
2051.At v7 . 2054.At v7 .
2052This 2055This
2053.Nm 2056.Nm
2054implementation is based on Adam De Boor's pmake program which was written 2057implementation is based on Adam De Boor's pmake program which was written
2055for Sprint at Berkeley. 2058for Sprint at Berkeley.
2056It was designed to be a parallel distributed make running jobs on different 2059It was designed to be a parallel distributed make running jobs on different
2057machines using a daemon called 2060machines using a daemon called
2058.Dq customs . 2061.Dq customs .
2059.Sh BUGS 2062.Sh BUGS
2060The 2063The
2061.Nm 2064.Nm
2062syntax is difficult to parse without actually acting of the data. 2065syntax is difficult to parse without actually acting of the data.
2063For instance finding the end of a variable use should involve scanning each 2066For instance finding the end of a variable use should involve scanning each
2064the modifiers using the correct terminator for each field. 2067the modifiers using the correct terminator for each field.
2065In many places 2068In many places
2066.Nm 2069.Nm
2067just counts {} and () in order to find the end of a variable expansion. 2070just counts {} and () in order to find the end of a variable expansion.
2068.Pp 2071.Pp
2069There is no way of escaping a space character in a filename. 2072There is no way of escaping a space character in a filename.