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