1BMAKE(1)                   FreeBSD    General   Commands   Manual
2BMAKE(1)
3
4[1mNAME[0m
5     [1mbmake [22m‐‐ maintain program dependencies
6
7[1mSYNOPSIS[0m
8     [1mbmake [22m[[1m‐BeikNnqrSstWwX[22m] [[1m‐C [4m[22mdirecto‐
9ry[24m] [[1m‐D [4m[22mvariable[24m] [[1m‐d [4m[22mflags[24m]
10           [[1m‐f   [4m[22mmakefile[24m]  [[1m‐I  [4m[22mdirecto‐
11ry[24m] [[1m‐J [4m[22mprivate[24m] [[1m‐j [4m[22mmax_jobs[24m]
12           [[1m‐m [4m[22mdirectory[24m]  [[1m‐T  [4m[22mfile[24m]
13[[1m‐V [4m[22mvariable[24m] [[1m‐v [4m[22mvariable[24m]
14           [[4mvariable=value[24m] [[4mtarget[24m [4m...[24m]
15
16[1mDESCRIPTION[0m
17     [1mbmake  [22mis  a program designed to simplify the mainte‐
18nance of other pro‐
19     grams.  Its input is a list  of  specifications  as  to  the
20files upon which
21     programs  and  other files depend.  If no [1m‐f [4m[22mmake‐
22file[24m makefile option is
23     given, [1mbmake [22mwill try to open ‘[4mmakefile[24m’  then
24‘[4mMakefile[24m’ in order to find
25     the specifications.  If the file ‘[4m.depend[24m’ exists, it
26is read (see
27     mkdep(1)).
28
29     This manual page is intended as a reference  document  only.
30For a more
31     thorough  description  of [1mbmake [22mand makefiles, please
32refer to [4mPMake[24m [4m‐[24m [4mA[0m
33     [4mTutorial[24m.
34
35     [1mbmake [22mwill  prepend  the  contents  of  the  [4mMAKE‐
36FLAGS[24m environment variable to
37     the command line arguments before parsing them.
38
39     The options are as follows:
40
41     [1m‐B      [22mTry to be backwards compatible by executing a
42single shell per
43             command and by executing the commands  to  make  the
44sources of a
45             dependency line in sequence.
46
47     [1m‐C [4m[22mdirectory[0m
48             Change  to [4mdirectory[24m before reading the make‐
49files or doing any‐
50             thing else.  If multiple [1m‐C [22moptions are spec‐
51ified, each is inter‐
52             preted   relative   to   the   previous  one:  [1m‐C
53[4m[22m/[24m [1m‐C [4m[22metc[24m is equivalent to
54             [1m‐C [4m[22m/etc[24m.
55
56     [1m‐D [4m[22mvariable[0m
57             Define [4mvariable[24m to be 1, in the global scope.
58
59     [1m‐d [4m[22m[‐]flags[0m
60             Turn on debugging, and  specify  which  portions  of
61[1mbmake [22mare to
62             print  debugging  information.  Unless the flags are
63preceded by
64             ‘‐’ they are added to the [4mMAKEFLAGS[24m  environ‐
65ment variable and will
66             be  processed  by  any child make processes.  By de‐
67fault, debugging
68             information is printed to standard error,  but  this
69can be changed
70             using  the  [4mF[24m  debugging flag.  The debugging
71output is always un‐
72             buffered; in addition, if debugging is  enabled  but
73debugging out‐
74             put  is  not  directed  to standard output, then the
75standard output
76             is line buffered.  [4mFlags[24m is one  or  more  of
77the following:
78
79             [4mA[24m       Print all possible debugging informa‐
80tion; equivalent to
81                     specifying all of the debugging flags.
82
83             [4ma[24m       Print debugging information about ar‐
84chive searching and
85                     caching.
86
87             [4mC[24m        Print  debugging  information  about
88current working direc‐
89                     tory.
90
91             [4mc[24m        Print  debugging  information  about
92conditional evaluation.
93
94             [4md[24m       Print debugging information about di‐
95rectory searching and
96                     caching.
97
98             [4me[24m        Print  debugging  information  about
99failed commands and
100                     targets.
101
102             [4mF[24m[[1m+[22m][4mfilename[0m
103                     Specify  where  debugging output is written.
104This must be
105                     the last flag, because it consumes  the  re‐
106mainder of the
107                     argument.   If the character immediately af‐
108ter the ‘F’
109                     flag is ‘+’, then the file will be opened in
110append mode;
111                     otherwise  the file will be overwritten.  If
112the file name
113                     is ‘stdout’ or ‘stderr’ then debugging  out‐
114put will be
115                     written  to  the standard output or standard
116error output
117                     file descriptors respectively (and  the  ‘+’
118option has no
119                     effect).   Otherwise,  the  output  will  be
120written to the
121                     named file.  If the  file  name  ends  ‘.%d’
122then the ‘%d’ is
123                     replaced by the pid.
124
125             [4mf[24m        Print  debugging  information  about
126loop evaluation.
127
128             [4mg1[24m      Print the input graph  before  making
129anything.
130
131             [4mg2[24m       Print  the  input graph after making
132everything, or before
133                     exiting on error.
134
135             [4mg3[24m      Print the input graph before  exiting
136on error.
137
138             [4mh[24m        Print  debugging  information  about
139hash table operations.
140
141             [4mj[24m        Print  debugging  information  about
142running multiple
143                     shells.
144
145             [4mL[24m       Turn on lint checks.  This will throw
146errors for variable
147                     assignments that do not parse correctly,  at
148the time of
149                     assignment  so  the file and line number are
150available.
151
152             [4ml[24m       Print commands in  Makefiles  regard‐
153less of whether or not
154                     they  are  prefixed  by ‘@’ or other "quiet"
155flags.  Also
156                     known as "loud" behavior.
157
158             [4mM[24m        Print  debugging  information  about
159"meta" mode decisions
160                     about targets.
161
162             [4mm[24m        Print  debugging  information  about
163making targets, includ‐
164                     ing modification dates.
165
166             [4mn[24m       Don’t delete  the  temporary  command
167scripts created when
168                     running  commands.   These temporary scripts
169are created in
170                     the directory referred to by the TMPDIR  en‐
171vironment vari‐
172                     able,  or  in [4m/tmp[24m if TMPDIR is unset
173or set to the empty
174                     string.  The temporary scripts  are  created
175by mkstemp(3),
176                     and     have     names     of    the    form
177[4mmakeXXXXXX[24m.  [4mNOTE[24m: This can
178                     create many files in TMPDIR or  [4m/tmp[24m,
179so use with care.
180
181             [4mp[24m        Print  debugging  information  about
182makefile parsing.
183
184             [4ms[24m        Print  debugging  information  about
185suffix‐transformation
186                     rules.
187
188             [4mt[24m        Print  debugging  information  about
189target list mainte‐
190                     nance.
191
192             [4mV[24m       Force the [1m‐V [22moption  to  print
193raw values of variables,
194                     overriding the default behavior set via
195                     [4m.MAKE.EXPAND_VARIABLES[24m.
196
197             [4mv[24m        Print  debugging  information  about
198variable assignment.
199
200             [4mx[24m       Run shell commands with [1m‐x  [22mso
201the actual commands are
202                     printed as they are executed.
203
204     [1m‐e       [22mSpecify  that environment variables override
205macro assignments
206             within makefiles.
207
208     [1m‐f [4m[22mmakefile[0m
209             Specify a makefile to read instead  of  the  default
210‘[4mmakefile[24m’.  If
211             [4mmakefile[24m  is  ‘[1m‐[22m’,  standard  input is
212read.  Multiple makefiles may
213             be specified, and are read in the order specified.
214
215     [1m‐I [4m[22mdirectory[0m
216             Specify a directory in which to search for makefiles
217and included
218             makefiles.  The system makefile directory (or direc‐
219tories, see
220             the [1m‐m [22moption) is automatically  included  as
221part of this list.
222
223     [1m‐i      [22mIgnore non‐zero exit of shell commands in the
224makefile.  Equiva‐
225             lent to specifying ‘[1m‐[22m’  before  each  command
226line in the makefile.
227
228     [1m‐J [4m[22mprivate[0m
229             This  option  should  [4mnot[24m be specified by the
230user.
231
232             When the [4mj[24m option is in use  in  a  recursive
233build, this option is
234             passed  by  a  make  to child makes to allow all the
235make processes
236             in the build to cooperate to avoid  overloading  the
237system.
238
239     [1m‐j [4m[22mmax_jobs[0m
240             Specify  the  maximum  number  of jobs that [1mbmake
241[22mmay have running at
242             any   one   time.    The   value   is    saved    in
243[4m.MAKE.JOBS[24m.  Turns compati‐
244             bility  mode  off,  unless the [4mB[24m flag is also
245specified.  When com‐
246             patibility mode is off, all commands associated with
247a target are
248             executed  in a single shell invocation as opposed to
249the tradi‐
250             tional one shell  invocation  per  line.   This  can
251break traditional
252             scripts which change directories on each command in‐
253vocation and
254             then expect to start with a fresh environment on the
255next line.
256             It  is  more efficient to correct the scripts rather
257than turn
258             backwards compatibility on.
259
260     [1m‐k      [22mContinue processing after errors are  encoun‐
261tered, but only on
262             those targets that do not depend on the target whose
263creation
264             caused the error.
265
266     [1m‐m [4m[22mdirectory[0m
267             Specify a directory in which to  search  for  sys.mk
268and makefiles
269             included  via the <[4mfile[24m>‐style include state‐
270ment.  The [1m‐m [22moption
271             can be used multiple times to form  a  search  path.
272This path will
273             override    the   default   system   include   path:
274/usr/share/mk.  Fur‐
275             thermore the system include path will be appended to
276the search
277             path used for "[4mfile[24m"‐style include statements
278(see the [1m‐I [22mop‐
279             tion).
280
281             If a file or directory name in the  [1m‐m  [22margu‐
282ment (or the
283             MAKESYSPATH  environment  variable)  starts with the
284string ".../"
285             then [1mbmake [22mwill search for the specified file
286or directory named
287             in  the  remaining part of the argument string.  The
288search starts
289             with the current directory of the Makefile and  then
290works upward
291             towards  the root of the file system.  If the search
292is success‐
293             ful,  then  the  resulting  directory  replaces  the
294".../" specifica‐
295             tion  in the [1m‐m [22margument.  If used, this fea‐
296ture allows [1mbmake [22mto
297             easily search in the current source tree for custom‐
298ized sys.mk
299             files  (e.g.,  by  using ".../mk/sys.mk" as an argu‐
300ment).
301
302     [1m‐n      [22mDisplay the commands that would have been ex‐
303ecuted, but do not
304             actually  execute  them unless the target depends on
305the .MAKE spe‐
306             cial source (see below) or the command  is  prefixed
307with ‘[1m+[22m’.
308
309     [1m‐N       [22mDisplay  the  commands which would have been
310executed, but do not
311             actually execute any of them; useful  for  debugging
312top‐level
313             makefiles without descending into subdirectories.
314
315     [1m‐q       [22mDo  not  execute any commands, but exit 0 if
316the specified targets
317             are up‐to‐date and 1, otherwise.
318
319     [1m‐r      [22mDo not use the built‐in  rules  specified  in
320the system makefile.
321
322     [1m‐S       [22mStop  processing if an error is encountered.
323This is the default
324             behavior and the opposite of [1m‐k[22m.
325
326     [1m‐s      [22mDo not echo any commands as they are  execut‐
327ed.  Equivalent to
328             specifying  ‘[1m@[22m’  before  each command line in
329the makefile.
330
331     [1m‐T [4m[22mtracefile[0m
332             When used with the [1m‐j [22mflag,  append  a  trace
333record to [4mtracefile[0m
334             for each job started and completed.
335
336     [1m‐t      [22mRather than re‐building a target as specified
337in the makefile,
338             create it or update its modification time to make it
339appear up‐
340             to‐date.
341
342     [1m‐V [4m[22mvariable[0m
343             Print  the  value  of [4mvariable[24m.  Do not build
344any targets.  Multiple
345             instances of this option may be specified; the vari‐
346ables will be
347             printed  one  per  line,  with a blank line for each
348null or unde‐
349             fined variable.  The value printed is extracted from
350the global
351             scope  after  all  makefiles have been read.  By de‐
352fault, the raw
353             variable contents (which may include additional  un‐
354expanded vari‐
355             able references) are shown.  If [4mvariable[24m con‐
356tains a ‘$’ then the
357             value will be recursively expanded to  its  complete
358resultant text
359             before  printing.   The  expanded value will also be
360printed if
361             [4m.MAKE.EXPAND_VARIABLES[24m is set to true and the
362[1m‐dV [22moption has not
363             been  used to override it.  Note that loop‐local and
364target‐local
365             variables, as well as values  taken  temporarily  by
366global vari‐
367             ables during makefile processing, are not accessible
368via this op‐
369             tion.  The [1m‐dv [22mdebug mode can be used to  see
370these at the cost of
371             generating substantial extraneous output.
372
373     [1m‐v [4m[22mvariable[0m
374             Like  [1m‐V  [22mbut the variable is always expanded
375to its complete
376             value.
377
378     [1m‐W      [22mTreat any warnings during makefile parsing as
379errors.
380
381     [1m‐w       [22mPrint  entering  and  leaving directory mes‐
382sages, pre and post pro‐
383             cessing.
384
385     [1m‐X      [22mDon’t export variables passed on the  command
386line to the environ‐
387             ment  individually.  Variables passed on the command
388line are
389             still exported via the [4mMAKEFLAGS[24m  environment
390variable.  This op‐
391             tion  may  be  useful  on systems which have a small
392limit on the
393             size of command arguments.
394
395     [4mvariable=value[0m
396             Set the value of  the  variable  [4mvariable[24m  to
397[4mvalue[24m.  Normally, all
398             values  passed on the command line are also exported
399to sub‐makes
400             in the environment.   The  [1m‐X  [22mflag  disables
401this behavior.  Vari‐
402             able  assignments  should  follow  options for POSIX
403compatibility
404             but no ordering is enforced.
405
406     There are seven different types of lines in a makefile: file
407dependency
408     specifications,  shell  commands,  variable assignments, in‐
409clude statements,
410     conditional directives, for loops, and comments.
411
412     In general, lines may be continued from one line to the next
413by ending
414     them  with a backslash (‘´).  The trailing newline character
415and initial
416     whitespace on the following line are compressed into a  sin‐
417gle space.
418
419[1mFILE DEPENDENCY SPECIFICATIONS[0m
420     Dependency  lines  consist of one or more targets, an opera‐
421tor, and zero or
422     more sources.  This creates a relationship where the targets
423"depend" on
424     the sources and are customarily created from them.  A target
425is consid‐
426     ered out‐of‐date if it does not exist, or if  its  modifica‐
427tion time is
428     less than that of any of its sources.  An out‐of‐date target
429will be re‐
430     created, but not until all sources have  been  examined  and
431themselves re‐
432     created as needed.  Three operators may be used:
433
434     [1m:      [22mMany dependency lines may name this target but
435only one may have
436           attached shell commands.  All sources named in all de‐
437pendency lines
438           are  considered  together,  and if needed the attached
439shell commands
440           are run to create or re‐create the target.   If  [1mb‐
441make [22mis inter‐
442           rupted, the target is removed.
443
444     [1m!      [22mThe  same, but the target is always re‐created
445whether or not it is
446           out of date.
447
448     [1m::    [22mAny dependency line  may  have  attached  shell
449commands, but each one
450           is  handled  independently: its sources are considered
451and the at‐
452           tached shell commands are run if the target is out  of
453date with re‐
454           spect to (only) those sources.  Thus, different groups
455of the at‐
456           tached shell commands may be run depending on the cir‐
457cumstances.
458           Furthermore,  unlike  [1m:,  [22mfor  dependency lines
459with no sources, the
460           attached shell commands are always run.   Also  unlike
461[1m:, [22mthe target
462           will not be removed if [1mbmake [22mis interrupted.
463     All dependency lines mentioning a particular target must use
464the same op‐
465     erator.
466
467     Targets and sources may contain the  shell  wildcard  values
468‘?’, ‘*’, ‘[]’,
469     and ‘{}’.  The values ‘?’, ‘*’, and ‘[]’ may only be used as
470part of the
471     final component of the target or source, and must be used to
472describe ex‐
473     isting  files.   The value ‘{}’ need not necessarily be used
474to describe
475     existing files.  Expansion is in directory order, not alpha‐
476betically as
477     done in the shell.
478
479[1mSHELL COMMANDS[0m
480     Each target may have associated with it one or more lines of
481shell com‐
482     mands, normally used to create  the  target.   Each  of  the
483lines in this
484     script  [4mmust[24m  be  preceded by a tab.  (For historical
485reasons, spaces are
486     not accepted.)  While targets can appear in many  dependency
487lines if de‐
488     sired, by default only one of these rules may be followed by
489a creation
490     script.  If the ‘[1m::[22m’ operator is used,  however,  all
491rules may include
492     scripts and the scripts are executed in the order found.
493
494     Each line is treated as a separate shell command, unless the
495end of line
496     is escaped with a backslash (‘´) in which case that line and
497the next
498     are  combined.   If  the first characters of the command are
499any combination
500     of ‘[1m@[22m’, ‘[1m+[22m’, or  ‘[1m‐[22m’,  the  command  is
501treated specially.  A ‘[1m@[22m’ causes the
502     command   not  to  be  echoed  before  it  is  executed.   A
503‘[1m+[22m’ causes the command
504     to be executed even when [1m‐n [22mis given.  This is  simi‐
505lar to the effect of
506     the .MAKE special source, except that the effect can be lim‐
507ited to a sin‐
508     gle line of a script.  A ‘[1m‐[22m’  in  compatibility  mode
509causes any non‐zero
510     exit status of the command line to be ignored.
511
512     When   [1mbmake   [22mis   run   in  jobs  mode  with  [1m‐j
513[4m[22mmax_jobs[24m, the entire script for
514     the target is fed to a single instance  of  the  shell.   In
515compatibility
516     (non‐jobs)  mode, each command is run in a separate process.
517If the com‐
518     mand     contains     any     shell     meta      characters
519(‘#=|^(){};&<>*?[]:$‘\n’) it
520     will be passed to the shell; otherwise [1mbmake [22mwill at‐
521tempt direct execu‐
522     tion.  If a line starts with ‘[1m‐[22m’ and  the  shell  has
523ErrCtl enabled then
524     failure  of  the command line will be ignored as in compati‐
525bility mode.
526     Otherwise ‘[1m‐[22m’ affects the entire job; the script will
527stop at the first
528     command  line  that fails, but the target will not be deemed
529to have
530     failed.
531
532     Makefiles should be written so that  the  mode  of  [1mbmake
533[22moperation does not
534     change their behavior.  For example, any command which needs
535to use "cd"
536     or "chdir" without potentially changing  the  directory  for
537subsequent com‐
538     mands  should be put in parentheses so it executes in a sub‐
539shell.  To
540     force the use of one shell, escape the line breaks so as  to
541make the
542     whole script one command.  For example:
543
544           avoid‐chdir‐side‐effects:
545                   @echo Building $@ in ‘pwd‘
546                   @(cd ${.CURDIR} && ${MAKE} $@)
547                   @echo Back in ‘pwd‘
548
549           ensure‐one‐shell‐regardless‐of‐mode:
550                   @echo      Building      $@      in     ‘pwd‘;
551(cd ${.CURDIR} && ${MAKE} $@);                     echo  Back  in
552‘pwd‘
553
554     Since  [1mbmake [22mwill chdir(2) to ‘[4m.OBJDIR[24m’ before
555executing any targets, each
556     child process starts with that as its current working direc‐
557tory.
558
559[1mVARIABLE ASSIGNMENTS[0m
560     Variables in make are much like variables in the shell, and,
561by tradi‐
562     tion, consist of all upper‐case letters.
563
564   [1mVariable assignment modifiers[0m
565     The five operators that can be  used  to  assign  values  to
566variables are as
567     follows:
568
569     [1m=       [22mAssign the value to the variable.  Any previ‐
570ous value is overrid‐
571             den.
572
573     [1m+=      [22mAppend the value to the current value of  the
574variable.
575
576     [1m?=      [22mAssign the value to the variable if it is not
577already defined.
578
579     [1m:=      [22mAssign with expansion, i.e. expand the  value
580before assigning it
581             to  the  variable.   Normally, expansion is not done
582until the vari‐
583             able is referenced.  [4mNOTE[24m: References to  un‐
584defined variables are
585             [4mnot[24m  expanded.   This can cause problems when
586variable modifiers
587             are used.
588
589     [1m!=      [22mExpand the value and pass it to the shell for
590execution and as‐
591             sign  the  result  to the variable.  Any newlines in
592the result are
593             replaced with spaces.
594
595     Any white‐space before the assigned [4mvalue[24m is removed;
596if the value is be‐
597     ing  appended, a single space is inserted between the previ‐
598ous contents of
599     the variable and the appended value.
600
601     Variables are expanded by surrounding the variable name with
602either curly
603     braces  (‘{}’) or parentheses (‘()’) and preceding it with a
604dollar sign
605     (‘$’).  If the variable name contains only a single  letter,
606the surround‐
607     ing  braces  or  parentheses are not required.  This shorter
608form is not
609     recommended.
610
611     If the variable name contains a dollar, then the name itself
612is expanded
613     first.  This allows almost arbitrary variable names, however
614names con‐
615     taining dollar, braces, parentheses, or whitespace are real‐
616ly best
617     avoided!
618
619     If the result of expanding a variable contains a dollar sign
620(‘$’) the
621     string is expanded again.
622
623     Variable substitution occurs at three  distinct  times,  de‐
624pending on where
625     the variable is being used.
626
627     1.    Variables in dependency lines are expanded as the line
628is read.
629
630     2.   Variables in shell commands are expanded when the shell
631command is
632          executed.
633
634     3.    ".for"  loop index variables are expanded on each loop
635iteration.
636          Note that other variables are not expanded inside loops
637so the fol‐
638          lowing example code:
639
640
641                .for i in 1 2 3
642                a+=     ${i}
643                j=      ${i}
644                b+=     ${j}
645                .endfor
646
647                all:
648                        @echo ${a}
649                        @echo ${b}
650
651          will print:
652
653                1 2 3
654                3 3 3
655
656          Because  while  ${a} contains "1 2 3" after the loop is
657executed, ${b}
658          contains "${j} ${j} ${j}" which  expands  to  "3  3  3"
659since after the
660          loop completes ${j} contains "3".
661
662   [1mVariable classes[0m
663     The  four  different  classes  of variables (in order of in‐
664creasing prece‐
665     dence) are:
666
667     Environment variables
668             Variables defined as part of [1mbmake[22m’s environ‐
669ment.
670
671     Global variables
672             Variables  defined  in  the  makefile or in included
673makefiles.
674
675     Command line variables
676             Variables defined as part of the command line.
677
678     Local variables
679             Variables that are defined  specific  to  a  certain
680target.
681
682     Local variables are all built in and their values vary magi‐
683cally from
684     target to target.  It is not currently  possible  to  define
685new local vari‐
686     ables.  The seven local variables are as follows:
687
688           [4m.ALLSRC[24m   The list of all sources for this tar‐
689get; also known as
690                     ‘[4m>[24m’.
691
692           [4m.ARCHIVE[24m  The name of the  archive  file;  also
693known as ‘[4m![24m’.
694
695           [4m.IMPSRC[24m    In  suffix‐transformation rules, the
696name/path of the
697                     source from which the target is to be trans‐
698formed (the
699                     "implied" source); also known as ‘[4m<[24m’.
700It is not defined
701                     in explicit rules.
702
703           [4m.MEMBER[24m   The name of the archive member;  also
704known as ‘[4m%[24m’.
705
706           [4m.OODATE[24m    The  list of sources for this target
707that were deemed out‐
708                     of‐date; also known as ‘[4m?[24m’.
709
710           [4m.PREFIX[24m   The file prefix of the  target,  con‐
711taining only the file
712                     portion,  no  suffix  or preceding directory
713components;
714                     also known as ‘[4m*[24m’.  The  suffix  must
715be one of the known
716                     suffixes  declared  with [1m.SUFFIXES [22mor
717it will not be recog‐
718                     nized.
719
720           [4m.TARGET[24m   The name of the target; also known as
721‘[4m@[24m’.  For compati‐
722                     bility with other makes this is an alias for
723[1m.ARCHIVE [22min
724                     archive member rules.
725
726     The  shorter  forms  (‘[4m>[24m’,  ‘[4m![24m’,   ‘[4m<[24m’,
727‘[4m%[24m’, ‘[4m?[24m’, ‘[4m*[24m’, and ‘[4m@[24m’) are permitted
728     for  backward  compatibility  with  historical makefiles and
729legacy POSIX
730     make and are not recommended.
731
732     Variants of these variables with  the  punctuation  followed
733immediately by
734     ‘D’  or  ‘F’, e.g.  ‘[4m$(@D)[24m’, are legacy forms equiva‐
735lent to using the ‘:H’
736     and ‘:T’ modifiers.  These forms are accepted  for  compati‐
737bility with AT&T
738     System V UNIX makefiles and POSIX but are not recommended.
739
740     Four of the local variables may be used in sources on depen‐
741dency lines
742     because they expand to the proper value for each  target  on
743the line.
744     These   variables  are  ‘[4m.TARGET[24m’,  ‘[4m.PREFIX[24m’,
745‘[4m.ARCHIVE[24m’, and ‘[4m.MEMBER[24m’.
746
747   [1mAdditional built‐in variables[0m
748     In addition, [1mbmake [22msets or knows about the  following
749variables:
750
751     [4m$[24m                A single dollar sign ‘$’, i.e.  ‘$$’
752expands to a single
753                     dollar sign.
754
755     [4m.ALLTARGETS[24m     The list of all  targets  encountered
756in the Makefile.  If
757                     evaluated during Makefile parsing, lists on‐
758ly those tar‐
759                     gets encountered thus far.
760
761     [4m.CURDIR[24m         A path to the directory  where  [1mb‐
762make [22mwas executed.  Refer
763                     to  the  description  of  ‘PWD’ for more de‐
764tails.
765
766     [4m.INCLUDEDFROMDIR[0m
767                     The directory of the file this Makefile  was
768included
769                     from.
770
771     [4m.INCLUDEDFROMFILE[0m
772                     The  filename  of the file this Makefile was
773included from.
774
775     MAKE            The name that [1mbmake [22mwas executed with
776([4margv[0][24m).  For
777                     compatibility    [1mbmake    [22malso   sets
778[4m.MAKE[24m with the same value.
779                     The preferred variable to use is  the  envi‐
780ronment variable
781                     MAKE because it is more compatible with oth‐
782er versions of
783                     [1mbmake [22mand cannot be confused with the
784special target with
785                     the same name.
786
787     [4m.MAKE.DEPENDFILE[0m
788                     Names   the   makefile   (default   ‘[4m.de‐
789pend[24m’) from which gener‐
790                     ated dependencies are read.
791
792     [4m.MAKE.EXPAND_VARIABLES[0m
793                     A boolean that controls the default behavior
794of the [1m‐V[0m
795                     option.   If  true,  variable values printed
796with [1m‐V [22mare
797                     fully expanded; if false, the  raw  variable
798contents
799                     (which  may  include  additional  unexpanded
800variable refer‐
801                     ences) are shown.
802
803     [4m.MAKE.EXPORTED[24m  The list  of  variables  exported  by
804[1mbmake[22m.
805
806     [4m.MAKE.JOBS[24m      The argument to the [1m‐j [22moption.
807
808     [4m.MAKE.JOB.PREFIX[0m
809                     If  [1mbmake  [22mis  run with [4mj[24m then
810output for each target is
811                     prefixed with a token ‘‐‐‐ target  ‐‐‐’  the
812first part of
813                     which      can     be     controlled     via
814[4m.MAKE.JOB.PREFIX[24m.  If
815                     [4m.MAKE.JOB.PREFIX[24m is empty,  no  token
816is printed.
817                     For example:
818                     .MAKE.JOB.PREFIX=${.new‐
819line}‐‐‐${.MAKE:T}[${.MAKE.PID}]
820                     would  produce  tokens  like  ‘‐‐‐make[1234]
821target ‐‐‐’ mak‐
822                     ing  it easier to track the degree of paral‐
823lelism being
824                     achieved.
825
826     MAKEFLAGS       The  environment  variable  ‘MAKEFLAGS’  may
827contain anything
828                     that may be specified on [1mbmake[22m’s com‐
829mand line.  Anything
830                     specified on [1mbmake[22m’s command line  is
831appended to the
832                     ‘MAKEFLAGS’  variable  which is then entered
833into the envi‐
834                     ronment  for  all  programs  which  [1mbmake
835[22mexecutes.
836
837     [4m.MAKE.LEVEL[24m      The recursion depth of [1mbmake[22m.
838The initial instance of
839                     [1mbmake [22mwill be 0, and  an  incremented
840value is put into the
841                     environment  to  be seen by the next genera‐
842tion.  This al‐
843                     lows tests like: .if ${.MAKE.LEVEL} == 0  to
844protect
845                     things which should only be evaluated in the
846initial in‐
847                     stance of [1mbmake[22m.
848
849     [4m.MAKE.MAKEFILE_PREFERENCE[0m
850                     The ordered list of makefile names  (default
851‘[4mmakefile[24m’,
852                     ‘[4mMakefile[24m’)  that  [1mbmake  [22mwill
853look for.
854
855     [4m.MAKE.MAKEFILES[0m
856                     The list of makefiles read by  [1mbmake[22m,
857which is useful for
858                     tracking  dependencies.   Each  makefile  is
859recorded only
860                     once, regardless  of  the  number  of  times
861read.
862
863     [4m.MAKE.MODE[24m       Processed  after  reading  all make‐
864files.  Can affect the
865                     mode that [1mbmake [22mruns in.  It can con‐
866tain a number of key‐
867                     words:
868
869                     [4mcompat[24m                Like [1m‐B[22m,
870puts [1mbmake [22minto "compat"
871                                          mode.
872
873                     [4mmeta[24m                  Puts   [1mbmake
874[22minto "meta" mode, where
875                                          meta  files are created
876for each tar‐
877                                          get to capture the com‐
878mand run, the
879                                          output generated and if
880filemon(4)
881                                          is available, the  sys‐
882tem calls which
883                                          are   of   interest  to
884[1mbmake[22m.  The cap‐
885                                          tured  output  can   be
886very useful when
887                                          diagnosing errors.
888
889                     [4mcurdirOk=[24m  [4mbf[24m         Normally
890[1mbmake [22mwill not create .meta
891                                          files   in    ‘[4m.CUR‐
892DIR[24m’.  This can be
893                                          overridden  by  setting
894[4mbf[24m to a value
895                                          which represents True.
896
897                     [4mmissing‐meta=[24m    [4mbf[24m         If
898[4mbf[24m is True, then a missing .meta
899                                          file  makes  the target
900out‐of‐date.
901
902                     [4mmissing‐filemon=[24m    [4mbf[24m      If
903[4mbf[24m is True, then missing filemon
904                                          data  makes  the target
905out‐of‐date.
906
907                     [4mnofilemon[24m            Do not use file‐
908mon(4).
909
910                     [4menv[24m                   For  debugging,
911it can be useful to
912                                          include the environment
913in the .meta
914                                          file.
915
916                     [4mverbose[24m                If  in  "meta"
917mode, print a clue
918                                          about the target  being
919built.  This
920                                          is  useful if the build
921is otherwise
922                                          running silently.   The
923message
924                                          printed the value of:
925                                          [4m.MAKE.META.PRE‐
926FIX[24m.
927
928                     [4mignore‐cmd[24m            Some  makefiles
929have commands which
930                                          are  simply not stable.
931This keyword
932                                          causes them to  be  ig‐
933nored for deter‐
934                                          mining whether a target
935is out of
936                                          date  in  "meta"  mode.
937See also
938                                          [1m.NOMETA_CMP[22m.
939
940                     [4msilent=[24m     [4mbf[24m              If
941[4mbf[24m is True, when a .meta file is
942                                          created, mark the  tar‐
943get [1m.SILENT[22m.
944
945     [4m.MAKE.META.BAILIWICK[0m
946                     In  "meta" mode, provides a list of prefixes
947which match
948                     the directories controlled by  [1mbmake[22m.
949If a file that was
950                     generated   outside  of  [4m.OBJDIR[24m  but
951within said bailiwick is
952                     missing, the current  target  is  considered
953out‐of‐date.
954
955     [4m.MAKE.META.CREATED[0m
956                     In  "meta"  mode,  this  variable contains a
957list of all the
958                     meta files updated.  If not empty, it can be
959used to
960                     trigger             processing            of
961[4m.MAKE.META.FILES[24m.
962
963     [4m.MAKE.META.FILES[0m
964                     In "meta" mode,  this  variable  contains  a
965list of all the
966                     meta files used (updated or not).  This list
967can be used
968                     to process the meta files to extract  depen‐
969dency informa‐
970                     tion.
971
972     [4m.MAKE.META.IGNORE_PATHS[0m
973                     Provides a list of path prefixes that should
974be ignored;
975                     because the contents are expected to  change
976over time.
977                     The   default  list  includes:  ‘[4m/dev[24m
978[4m/etc[24m [4m/proc[24m [4m/tmp[24m [4m/var/run[0m
979                     [4m/var/tmp[24m’
980
981     [4m.MAKE.META.IGNORE_PATTERNS[0m
982                     Provides a list of patterns to match against
983pathnames.
984                     Ignore any that match.
985
986     [4m.MAKE.META.IGNORE_FILTER[0m
987                     Provides a list of variable modifiers to ap‐
988ply to each
989                     pathname.  Ignore if  the  expansion  is  an
990empty string.
991
992     [4m.MAKE.META.PREFIX[0m
993                     Defines  the  message  printed for each meta
994file updated in
995                     "meta verbose" mode.  The default value is:
996                           Building ${.TARGET:H:tA}/${.TARGET:T}
997
998     [4m.MAKEOVERRIDES[24m  This variable is used to  record  the
999names of variables
1000                     assigned  to  on  the  command line, so that
1001they may be ex‐
1002                     ported as part of ‘MAKEFLAGS’.  This  behav‐
1003ior can be dis‐
1004                     abled   by   assigning  an  empty  value  to
1005‘[4m.MAKEOVERRIDES[24m’
1006                     within a makefile.  Extra variables  can  be
1007exported from
1008                     a  makefile  by  appending  their  names  to
1009‘[4m.MAKEOVERRIDES[24m’.
1010                     ‘MAKEFLAGS’    is    re‐exported    whenever
1011‘[4m.MAKEOVERRIDES[24m’ is
1012                     modified.
1013
1014     [4m.MAKE.PATH_FILEMON[0m
1015                     If  [1mbmake  [22mwas  built with filemon(4)
1016support, this is set
1017                     to the path of the device node.  This allows
1018makefiles to
1019                     test for this support.
1020
1021     [4m.MAKE.PID[24m       The process‐id of [1mbmake[22m.
1022
1023     [4m.MAKE.PPID[24m        The   parent  process‐id  of  [1mb‐
1024make[22m.
1025
1026     [4m.MAKE.SAVE_DOLLARS[0m
1027                     value should  be  a  boolean  that  controls
1028whether ‘$$’ are
1029                     preserved  when doing ‘:=’ assignments.  The
1030default is
1031                     false, for backwards compatibility.  Set  to
1032true for com‐
1033                     patability  with  other  makes.   If  set to
1034false, ‘$$’ be‐
1035                     comes ‘$’ per normal evaluation rules.
1036
1037     [4m.MAKE.UID[24m       The user‐id running [1mbmake[22m.
1038
1039     [4m.MAKE.GID[24m       The group‐id running [1mbmake[22m.
1040
1041     [4mMAKE_PRINT_VAR_ON_ERROR[0m
1042                     When [1mbmake [22mstops due to an error,  it
1043sets ‘[4m.ERROR_TARGET[24m’
1044                     to  the  name  of  the  target  that failed,
1045‘[4m.ERROR_CMD[24m’ to
1046                     the commands of the failed  target,  and  in
1047"meta" mode, it
1048                     also   sets   ‘[4m.ERROR_CWD[24m’   to   the
1049getcwd(3), and
1050                     ‘[4m.ERROR_META_FILE[24m’ to the path of the
1051meta file (if any)
1052                     describing   the  failed  target.   It  then
1053prints its name
1054                     and the value of ‘[4m.CURDIR[24m’ as well as
1055the value of any
1056                     variables named in ‘[4mMAKE_PRINT_VAR_ON_ER‐
1057ROR[24m’.
1058
1059     [4m.newline[24m        This variable is  simply  assigned  a
1060newline character as
1061                     its value.  This allows expansions using the
1062[1m:@ [22mmodifier
1063                     to put a newline between iterations  of  the
1064loop rather
1065                     than a space.  For example, the printing of
1066                     ‘[4mMAKE_PRINT_VAR_ON_ERROR[24m’   could  be
1067done as
1068                     ${MAKE_PRINT_VAR_ON_ER‐
1069ROR:@v@$v=’${$v}’${.newline}@}.
1070
1071     [4m.OBJDIR[24m          A  path  to  the directory where the
1072targets are built.  Its
1073                     value is determined by trying to chdir(2) to
1074the follow‐
1075                     ing directories in order and using the first
1076match:
1077
1078                     1.   ${MAKEOBJDIRPREFIX}${.CURDIR}
1079
1080                          (Only if ‘MAKEOBJDIRPREFIX’ is  set  in
1081the environ‐
1082                          ment or on the command line.)
1083
1084                     2.   ${MAKEOBJDIR}
1085
1086                          (Only if ‘MAKEOBJDIR’ is set in the en‐
1087vironment or
1088                          on the command line.)
1089
1090                     3.   ${.CURDIR}[4m/obj.[24m${MACHINE}
1091
1092                     4.   ${.CURDIR}[4m/obj[0m
1093
1094                     5.   [4m/usr/obj/[24m${.CURDIR}
1095
1096                     6.   ${.CURDIR}
1097
1098                     Variable expansion is performed on the value
1099before it’s
1100                     used, so expressions such as
1101                           ${.CURDIR:S,^/usr/src,/var/obj,}
1102                     may be used.  This is especially useful with
1103                     ‘MAKEOBJDIR’.
1104
1105                     ‘[4m.OBJDIR[24m’  may  be  modified  in  the
1106makefile via the special
1107                     target  ‘[1m.OBJDIR[22m’.   In  all   cases,
1108[1mbmake [22mwill chdir(2) to
1109                     the  specified  directory  if it exists, and
1110set ‘[4m.OBJDIR[24m’
1111                     and ‘PWD’ to that directory before executing
1112any targets.
1113
1114                     Except  in  the case of an explicit ‘[1m.OB‐
1115JDIR[22m’ target, [1mbmake[0m
1116                     will check that the specified  directory  is
1117writable and
1118                     ignore it if not.  This check can be skipped
1119by setting
1120                     the    environment    variable     ‘MAKE_OB‐
1121JDIR_CHECK_WRITABLE’ to
1122                     "no".
1123
1124     [4m.PARSEDIR[24m        A  path to the directory of the cur‐
1125rent ‘[4mMakefile[24m’ being
1126                     parsed.
1127
1128     [4m.PARSEFILE[24m      The basename of the current ‘[4mMake‐
1129file[24m’ being parsed.
1130                     This  variable  and  ‘[4m.PARSEDIR[24m’  are
1131both set only while the
1132                     ‘[4mMakefiles[24m’ are being parsed.  If you
1133want to retain
1134                     their current values, assign them to a vari‐
1135able using as‐
1136                     signment with expansion: (‘[1m:=[22m’).
1137
1138     [4m.PATH[24m           A variable that represents  the  list
1139of directories that
1140                     [1mbmake  [22mwill  search  for  files.  The
1141search list should be
1142                     updated  using  the  target   ‘[4m.PATH[24m’
1143rather than the vari‐
1144                     able.
1145
1146     PWD              Alternate  path  to  the current directory.
1147[1mbmake [22mnormally
1148                     sets ‘[4m.CURDIR[24m’ to the canonical  path
1149given by getcwd(3).
1150                     However,  if  the environment variable ‘PWD’
1151is set and
1152                     gives a path to the current directory,  then
1153[1mbmake [22msets
1154                     ‘[4m.CURDIR[24m’  to  the value of ‘PWD’ in‐
1155stead.  This behavior
1156                     is disabled if ‘MAKEOBJDIRPREFIX’ is set  or
1157‘MAKEOBJDIR’
1158                     contains a variable transform.  ‘PWD’ is set
1159to the value
1160                     of ‘[4m.OBJDIR[24m’ for all  programs  which
1161[1mbmake [22mexecutes.
1162
1163     .SHELL          The pathname of the shell used to run target
1164scripts.  It
1165                     is read‐only.
1166
1167     .TARGETS        The list of targets explicitly specified  on
1168the command
1169                     line, if any.
1170
1171     VPATH            Colon‐separated  (":") lists of directories
1172that [1mbmake[0m
1173                     will search for files.  The variable is sup‐
1174ported for
1175                     compatibility  with  old make programs only,
1176use ‘[4m.PATH[24m’
1177                     instead.
1178
1179   [1mVariable modifiers[0m
1180     Variable expansion may be modified to select or modify  each
1181word of the
1182     variable  (where  a "word" is white‐space delimited sequence
1183of charac‐
1184     ters).  The general format of a  variable  expansion  is  as
1185follows:
1186
1187           ${variable[:modifier[:...]]}
1188
1189     Each modifier begins with a colon, which may be escaped with
1190a backslash
1191     (‘´).
1192
1193     A set of modifiers can be specified via a variable, as  fol‐
1194lows:
1195
1196           modifier_variable=modifier[:...]
1197           ${variable:${modifier_variable}[:...]}
1198
1199     In  this  case  the  first modifier in the modifier_variable
1200does not start
1201     with a colon, since that  must  appear  in  the  referencing
1202variable.  If any
1203     of  the  modifiers in the modifier_variable contain a dollar
1204sign (‘$’),
1205     these must be doubled to avoid early expansion.
1206
1207     The supported modifiers are:
1208
1209     [1m:E   [22mReplaces each word in the variable with its suf‐
1210fix.
1211
1212     [1m:H    [22mReplaces  each word in the variable with every‐
1213thing but the last com‐
1214          ponent.
1215
1216     [1m:M[4m[22mpattern[0m
1217          Selects only those  words  that  match  [4mpattern[24m.
1218The standard shell
1219          wildcard  characters  (‘*’, ‘?’, and ‘[]’) may be used.
1220The wildcard
1221          characters may be escaped with a backslash (‘´).  As  a
1222consequence
1223          of  the  way  values are split into words, matched, and
1224then joined, a
1225          construct like
1226                ${VAR:M*}
1227          will normalize the  inter‐word  spacing,  removing  all
1228leading and
1229          trailing  space,  and  converting  multiple consecutive
1230spaces to single
1231          spaces.
1232
1233     [1m:N[4m[22mpattern[0m
1234          This is identical to ‘[1m:M[22m’, but selects all words
1235which do not match
1236          [4mpattern[24m.
1237
1238     [1m:O   [22mOrders every word in variable alphabetically.
1239
1240     [1m:On   [22mOrders  every  word in variable numerically.  A
1241number followed by one
1242          of ‘k’, ‘M’ or ‘G’ is  multiplied  by  the  appropriate
1243factor (1024
1244          (k),  1048576 (M), or 1073741824 (G)).  Both upper‐ and
1245lower‐case
1246          letters are accepted.
1247
1248     [1m:Or  [22mOrders every word in variable in reverse  alpha‐
1249betical order.
1250
1251     [1m:Orn[0m
1252          Orders  every word in variable in reverse numerical or‐
1253der.
1254
1255     [1m:Ox  [22mShuffles the words  in  variable.   The  results
1256will be different each
1257          time  you  are  referring to the modified variable; use
1258the assignment
1259          with expansion (‘[1m:=[22m’) to prevent such  behavior.
1260For example,
1261
1262                LIST=                   uno due tre quattro
1263                RANDOM_LIST=            ${LIST:Ox}
1264                STATIC_RANDOM_LIST:=    ${LIST:Ox}
1265
1266                all:
1267                        @echo "${RANDOM_LIST}"
1268                        @echo "${RANDOM_LIST}"
1269                        @echo "${STATIC_RANDOM_LIST}"
1270                        @echo "${STATIC_RANDOM_LIST}"
1271          may produce output similar to:
1272
1273                quattro due tre uno
1274                tre due quattro uno
1275                due uno quattro tre
1276                due uno quattro tre
1277
1278     [1m:Q    [22mQuotes  every shell meta‐character in the vari‐
1279able, so that it can be
1280          passed safely to the shell.
1281
1282     [1m:q   [22mQuotes every shell meta‐character in  the  vari‐
1283able, and also doubles
1284          ‘$’  characters so that it can be passed safely through
1285recursive in‐
1286          vocations of  [1mbmake[22m.   This  is  equivalent  to:
1287‘:S/&&/g:Q’.
1288
1289     [1m:R    [22mReplaces  each word in the variable with every‐
1290thing but its suffix.
1291
1292     [1m:range[=count][0m
1293          The value is an integer sequence representing the words
1294of the orig‐
1295          inal value, or the supplied [4mcount[24m.
1296
1297     [1m:gmtime[=utc][0m
1298          The value is a format string for strftime(3), using gm‐
1299time(3).  If a
1300          [4mutc[24m value is not provided or is 0,  the  current
1301time is used.
1302
1303     [1m:hash[0m
1304          Computes  a  32‐bit  hash of the value and encode it as
1305hex digits.
1306
1307     [1m:localtime[=utc][0m
1308          The value is a format string for strftime(3), using lo‐
1309caltime(3).
1310          If a [4mutc[24m value is not provided or is 0, the cur‐
1311rent time is used.
1312
1313     [1m:tA  [22mAttempts to convert variable to an absolute path
1314using realpath(3),
1315          if that fails, the value is unchanged.
1316
1317     [1m:tl  [22mConverts variable to lower‐case letters.
1318
1319     [1m:ts[4m[22mc[0m
1320          Words in the variable are normally separated by a space
1321on expan‐
1322          sion.  This modifier sets the separator to the  charac‐
1323ter [4mc[24m.  If [4mc[24m is
1324          omitted, then no separator is used.  The common escapes
1325(including
1326          octal numeric codes) work as expected.
1327
1328     [1m:tu  [22mConverts variable to upper‐case letters.
1329
1330     [1m:tW  [22mCauses the value to be treated as a single  word
1331(possibly containing
1332          embedded white space).  See also ‘[1m:[*][22m’.
1333
1334     [1m:tw   [22mCauses the value to be treated as a sequence of
1335words delimited by
1336          white space.  See also ‘[1m:[@][22m’.
1337
1338     [1m:S[22m/[4mold_string[24m/[4mnew_string[24m/[[1m1gW[22m]
1339          Modifies the first occurrence of  [4mold_string[24m  in
1340each word of the
1341          variable’s  value, replacing it with [4mnew_string[24m.
1342If a ‘g’ is ap‐
1343          pended to the last delimiter of the pattern, all occur‐
1344rences in each
1345          word  are  replaced.   If a ‘1’ is appended to the last
1346delimiter of
1347          the pattern, only the first occurrence is affected.  If
1348a ‘W’ is ap‐
1349          pended  to  the last delimiter of the pattern, then the
1350value is
1351          treated as a single word (possibly containing  embedded
1352white space).
1353          If   [4mold_string[24m   begins  with  a  caret  (‘^’),
1354[4mold_string[24m is anchored at
1355          the beginning of each word.  If [4mold_string[24m  ends
1356with a dollar sign
1357          (‘$’),  it is anchored at the end of each word.  Inside
1358[4mnew_string[24m,
1359          an ampersand (‘&’)  is  replaced  by  [4mold_string[24m
1360(without any ‘^’ or
1361          ‘$’).  Any character may be used as a delimiter for the
1362parts of the
1363          modifier string.  The anchoring, ampersand  and  delim‐
1364iter characters
1365          may be escaped with a backslash (‘´).
1366
1367          Variable  expansion occurs in the normal fashion inside
1368both
1369          [4mold_string[24m and [4mnew_string[24m with the single
1370exception that a backslash
1371          is  used  to  prevent  the  expansion  of a dollar sign
1372(‘$’), not a pre‐
1373          ceding dollar sign as is usual.
1374
1375     [1m:C[22m/[4mpattern[24m/[4mreplacement[24m/[[1m1gW[22m]
1376          The [1m:C [22mmodifier is just like the [1m:S [22mmodi‐
1377fier except that the old and
1378          new  strings,  instead  of being simple strings, are an
1379extended regu‐
1380          lar expression (see regex(3)) string [4mpattern[24m and
1381an ed(1)‐style
1382          string  [4mreplacement[24m.  Normally, the first occur‐
1383rence of the pattern
1384          [4mpattern[24m in each word of the value is substituted
1385with [4mreplacement[24m.
1386          The ‘1’ modifier causes the substitution to apply to at
1387most one
1388          word; the ‘g’ modifier causes the substitution to apply
1389to as many
1390          instances of the search pattern [4mpattern[24m as occur
1391in the word or
1392          words it is found in; the ‘W’ modifier causes the value
1393to be
1394          treated  as a single word (possibly containing embedded
1395white space).
1396
1397          As for the [1m:S [22mmodifier, the  [4mpattern[24m  and
1398[4mreplacement[24m are subjected to
1399          variable  expansion  before being parsed as regular ex‐
1400pressions.
1401
1402     [1m:T   [22mReplaces each word in the variable with its last
1403path component.
1404
1405     [1m:u   [22mRemoves adjacent duplicate words (like uniq(1)).
1406
1407     [1m:?[4m[22mtrue_string[24m[1m:[4m[22mfalse_string[0m
1408          If  the variable name (not its value), when parsed as a
1409.if condi‐
1410          tional expression, evaluates to  true,  return  as  its
1411value the
1412          [4mtrue_string[24m,      otherwise      return      the
1413[4mfalse_string[24m.  Since the variable
1414          name is used as the expression, :? must  be  the  first
1415modifier after
1416          the  variable name itself ‐ which will, of course, usu‐
1417ally contain
1418          variable expansions.  A common error is trying  to  use
1419expressions
1420          like
1421                ${NUMBERS:M42:?match:no}
1422          which  actually tests defined(NUMBERS), to determine if
1423any words
1424          match "42" you need to use something like:
1425                ${"${NUMBERS:M42}" != "":?match:no}.
1426
1427     [4m:old_string=new_string[0m
1428          This is the AT&T System V UNIX style variable substitu‐
1429tion.  It must
1430          be  the  last modifier specified.  If [4mold_string[24m
1431or [4mnew_string[24m do not
1432          contain the pattern matching character [4m%[24m then it
1433is assumed that
1434          they are anchored at the end of each word, so only suf‐
1435fixes or en‐
1436          tire words may be replaced.  Otherwise [4m%[24m is  the
1437substring of
1438          [4mold_string[24m  to be replaced in [4mnew_string[24m.
1439If only [4mold_string[24m con‐
1440          tains the  pattern  matching  character  [4m%[24m,  and
1441[4mold_string[24m matches, then
1442          the  result  is  the  [4mnew_string[24m.   If  only the
1443[4mnew_string[24m contains the
1444          pattern matching character [4m%[24m,  then  it  is  not
1445treated specially and
1446          it is printed as a literal [4m%[24m on match.  If there
1447is more than one
1448          pattern matching character  ([4m%[24m)  in  either  the
1449[4mnew_string[24m or
1450          [4mold_string[24m,  only  the first instance is treated
1451specially (as the
1452          pattern character); all subsequent instances are treat‐
1453ed as regular
1454          characters.
1455
1456          Variable  expansion occurs in the normal fashion inside
1457both
1458          [4mold_string[24m and [4mnew_string[24m with the single
1459exception that a backslash
1460          is  used  to  prevent  the  expansion  of a dollar sign
1461(‘$’), not a pre‐
1462          ceding dollar sign as is usual.
1463
1464     [1m:@[4m[22mtemp[24m[1m@[4m[22mstring[24m[1m@[0m
1465          This is the loop expansion mechanism from the  OSF  De‐
1466velopment Envi‐
1467          ronment  (ODE)  make.  Unlike [1m.for [22mloops, expan‐
1468sion occurs at the time
1469          of reference.  Assigns [4mtemp[24m to each word in  the
1470variable and evalu‐
1471          ates   [4mstring[24m.    The  ODE  convention  is  that
1472[4mtemp[24m should start and end
1473          with a period.  For example.
1474                ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
1475
1476          However a single character variable is often more read‐
1477able:
1478                ${MAKE_PRINT_VAR_ON_ERROR:@v@$v=’${$v}’${.new‐
1479line}@}
1480
1481     [1m:_[=var][0m
1482          Saves the current variable value in ‘$_’ or  the  named
1483[4mvar[24m for later
1484          reference.  Example usage:
1485
1486                M_cmpv.units = 1 1000 1000000
1487                M_cmpv   =   S,.,   ,g:_:range:@i@+  $${_:[‐$$i]}
1488$${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh
1489
1490                .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}}
1491
1492          Here ‘$_’ is used to save the result of the ‘:S’  modi‐
1493fier which is
1494          later referenced using the index values from ‘:range’.
1495
1496     [1m:U[4m[22mnewval[0m
1497          If the variable is undefined, [4mnewval[24m is the val‐
1498ue.  If the variable
1499          is defined, the existing value is  returned.   This  is
1500another ODE
1501          make  feature.   It  is  handy  for  setting per‐target
1502CFLAGS for in‐
1503          stance:
1504                ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}}
1505          If a value is only required if the  variable  is  unde‐
1506fined, use:
1507                ${VAR:D:Unewval}
1508
1509     [1m:D[4m[22mnewval[0m
1510          If the variable is defined, [4mnewval[24m is the value.
1511
1512     [1m:L   [22mThe name of the variable is the value.
1513
1514     [1m:P    [22mThe path of the node which has the same name as
1515the variable is the
1516          value.  If no such node exists or  its  path  is  null,
1517then the name of
1518          the  variable  is  used.  In order for this modifier to
1519work, the name
1520          (node) must at least have appeared on the rhs of a  de‐
1521pendency.
1522
1523     [1m:![4m[22mcmd[24m[1m![0m
1524          The output of running [4mcmd[24m is the value.
1525
1526     [1m:sh  [22mIf the variable is non‐empty it is run as a com‐
1527mand and the output
1528          becomes the new value.
1529
1530     [1m::=[4m[22mstr[0m
1531          The variable is assigned  the  value  [4mstr[24m  after
1532substitution.  This
1533          modifier and its variations are useful in obscure situ‐
1534ations such as
1535          wanting to set a variable when shell commands are being
1536parsed.
1537          These assignment modifiers always expand to nothing, so
1538if appearing
1539          in a rule line by themselves should  be  preceded  with
1540something to
1541          keep [1mbmake [22mhappy.
1542
1543          The ‘[1m::[22m’ helps avoid false matches with the AT&T
1544System V UNIX style
1545          [1m:= [22mmodifier and since substitution always occurs
1546the [1m::= [22mform is
1547          vaguely appropriate.
1548
1549     [1m::?=[4m[22mstr[0m
1550          As for [1m::= [22mbut only if the variable does not al‐
1551ready have a value.
1552
1553     [1m::+=[4m[22mstr[0m
1554          Append [4mstr[24m to the variable.
1555
1556     [1m::!=[4m[22mcmd[0m
1557          Assign the output of [4mcmd[24m to the variable.
1558
1559     [1m:[[4m[22mrange[24m[1m][0m
1560          Selects one or more words from the value,  or  performs
1561other opera‐
1562          tions  related to the way in which the value is divided
1563into words.
1564
1565          Ordinarily, a value is treated as a sequence  of  words
1566delimited by
1567          white  space.   Some  modifiers suppress this behavior,
1568causing a value
1569          to be treated as a single word (possibly containing em‐
1570bedded white
1571          space).   An  empty value, or a value that consists en‐
1572tirely of white‐
1573          space, is treated as a single word.  For  the  purposes
1574of the ‘[1m:[][22m’
1575          modifier,  the  words  are  indexed both forwards using
1576positive inte‐
1577          gers (where index 1 represents  the  first  word),  and
1578backwards using
1579          negative  integers  (where index ‐1 represents the last
1580word).
1581
1582          The [4mrange[24m is subjected  to  variable  expansion,
1583and the expanded re‐
1584          sult is then interpreted as follows:
1585
1586          [4mindex[24m  Selects a single word from the value.
1587
1588          [4mstart[24m[1m..[4m[22mend[0m
1589                 Selects   all   words   from   [4mstart[24m   to
1590[4mend[24m, inclusive.  For example,
1591                 ‘[1m:[2..‐1][22m’ selects  all  words  from  the
1592second word to the last
1593                 word.    If   [4mstart[24m   is   greater   than
1594[4mend[24m, then the words are out‐
1595                 put   in   reverse    order.     For    example,
1596‘[1m:[‐1..1][22m’ selects all
1597                 the  words  from  last to first.  If the list is
1598already or‐
1599                 dered, then this effectively reverses the  list,
1600but it is
1601                 more  efficient  to  use ‘[1m:Or[22m’ instead of
1602‘[1m:O:[‐1..1][22m’.
1603
1604          [1m*      [22mCauses subsequent modifiers to treat  the
1605value as a single
1606                 word (possibly containing embedded white space).
1607Analogous
1608                 to the effect of "$*" in Bourne shell.
1609
1610          0      Means the same as ‘[1m:[*][22m’.
1611
1612          [1m@      [22mCauses subsequent modifiers to treat  the
1613value as a sequence
1614                 of words delimited by white space.  Analogous to
1615the effect
1616                 of "$@" in Bourne shell.
1617
1618          [1m#      [22mReturns the number of words in the value.
1619
1620[1mINCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS[0m
1621     Makefile inclusion, conditional  structures  and  for  loops
1622reminiscent of
1623     the  C  programming  language  are provided in [1mbmake[22m.
1624All such structures
1625     are identified by a line beginning with a single  dot  (‘.’)
1626character.
1627     Files     are     included     with    either    [1m.include
1628<[4m[22mfile[24m[1m> [22mor [1m.include "[4m[22mfile[24m[1m"[22m.
1629Vari‐
1630     ables  between  the  angle brackets or double quotes are ex‐
1631panded to form
1632     the file name.  If angle brackets  are  used,  the  included
1633makefile is ex‐
1634     pected  to  be  in the system makefile directory.  If double
1635quotes are
1636     used, the including makefile’s directory and any directories
1637specified
1638     using  the  [1m‐I  [22moption are searched before the system
1639makefile directory.
1640     For compatibility with other versions of  [1mbmake  [22m‘in‐
1641clude file ...’ is also
1642     accepted.
1643
1644     If  the  include statement is written as [1m.‐include [22mor
1645as [1m.sinclude [22mthen er‐
1646     rors locating and/or opening include files are ignored.
1647
1648     If the include statement is written as [1m.dinclude  [22mnot
1649only are errors lo‐
1650     cating  and/or  opening include files ignored, but stale de‐
1651pendencies
1652     within  the  included  file  will  be  ignored   just   like
1653[4m.MAKE.DEPENDFILE[24m.
1654
1655     Conditional expressions are also preceded by a single dot as
1656the first
1657     character of a line.  The possible conditionals are as  fol‐
1658lows:
1659
1660     [1m.error [4m[22mmessage[0m
1661             The  message  is  printed along with the name of the
1662makefile and
1663             line number, then [1mbmake [22mwill exit  immediate‐
1664ly.
1665
1666     [1m.export [4m[22mvariable[24m [4m...[0m
1667             Export  the  specified global variable.  If no vari‐
1668able list is
1669             provided, all globals are exported except for inter‐
1670nal variables
1671             (those  that  start with ‘.’).  This is not affected
1672by the [1m‐X[0m
1673             flag, so should be used with caution.  For  compati‐
1674bility with
1675             other  [1mbmake [22mprograms ‘export variable=value’
1676is also accepted.
1677
1678             Appending a variable name  to  [4m.MAKE.EXPORTED[24m
1679is equivalent to ex‐
1680             porting a variable.
1681
1682     [1m.export‐env [4m[22mvariable[24m [4m...[0m
1683             The  same  as ‘.export’, except that the variable is
1684not appended
1685             to [4m.MAKE.EXPORTED[24m.  This allows  exporting  a
1686value to the environ‐
1687             ment  which  is different from that used by [1mbmake
1688[22minternally.
1689
1690     [1m.export‐literal [4m[22mvariable[24m [4m...[0m
1691             The same as ‘.export‐env’, except that variables  in
1692the value are
1693             not expanded.
1694
1695     [1m.info [4m[22mmessage[0m
1696             The  message  is  printed along with the name of the
1697makefile and
1698             line number.
1699
1700     [1m.undef [4m[22mvariable[24m [4m...[0m
1701             Un‐define  the  specified  global  variables.   Only
1702global variables
1703             can be un‐defined.
1704
1705     [1m.unexport [4m[22mvariable[24m [4m...[0m
1706             The  opposite  of  ‘.export’.   The specified global
1707[4mvariable[24m will be
1708             removed from [4m.MAKE.EXPORTED[24m.  If no  variable
1709list is provided,
1710             all  globals  are  unexported,  and [4m.MAKE.EXPORT‐
1711ED[24m deleted.
1712
1713     [1m.unexport‐env[0m
1714             Unexport all globals previously exported  and  clear
1715the environ‐
1716             ment inherited from the parent.  This operation will
1717cause a mem‐
1718             ory leak of the original environment, so  should  be
1719used spar‐
1720             ingly.   Testing  for  [4m.MAKE.LEVEL[24m  being  0,
1721would make sense.  Also
1722             note that any variables which originated in the par‐
1723ent environ‐
1724             ment should be explicitly preserved if desired.  For
1725example:
1726
1727                   .if ${.MAKE.LEVEL} == 0
1728                   PATH := ${PATH}
1729                   .unexport‐env
1730                   .export PATH
1731                   .endif
1732
1733             Would  result  in  an  environment  containing  only
1734‘PATH’, which is
1735             the    minimal    useful    environment.    Actually
1736‘.MAKE.LEVEL’ will also
1737             be pushed into the new environment.
1738
1739     [1m.warning [4m[22mmessage[0m
1740             The message prefixed by ‘[4mwarning:[24m’ is printed
1741along with the name
1742             of the makefile and line number.
1743
1744     [1m.if  [22m[!][4mexpression[24m [[4moperator[24m [4mexpres‐
1745sion[24m [4m...[24m]
1746             Test the value of an expression.
1747
1748     [1m.ifdef [22m[!][4mvariable[24m  [[4moperator[24m  [4mvari‐
1749able[24m [4m...[24m]
1750             Test the value of a variable.
1751
1752     [1m.ifndef  [22m[!][4mvariable[24m [[4moperator[24m [4mvari‐
1753able[24m [4m...[24m]
1754             Test the value of a variable.
1755
1756     [1m.ifmake  [22m[!][4mtarget[24m  [[4moperator[24m   [4mtar‐
1757get[24m [4m...[24m]
1758             Test the target being built.
1759
1760     [1m.ifnmake  [22m[!]  [4mtarget[24m [[4moperator[24m [4mtar‐
1761get[24m [4m...[24m]
1762             Test the target being built.
1763
1764     [1m.else   [22mReverse the sense of the last conditional.
1765
1766     [1m.elif [22m[!] [4mexpression[24m  [[4moperator[24m  [4mex‐
1767pression[24m [4m...[24m]
1768             A   combination   of   ‘[1m.else[22m’   followed  by
1769‘[1m.if[22m’.
1770
1771     [1m.elifdef [22m[!][4mvariable[24m [[4moperator[24m [4mvari‐
1772able[24m [4m...[24m]
1773             A   combination   of   ‘[1m.else[22m’   followed  by
1774‘[1m.ifdef[22m’.
1775
1776     [1m.elifndef     [22m[!][4mvariable[24m     [[4moperator[24m
1777[4mvariable[24m [4m...[24m]
1778             A   combination   of   ‘[1m.else[22m’   followed  by
1779‘[1m.ifndef[22m’.
1780
1781     [1m.elifmake [22m[!][4mtarget[24m  [[4moperator[24m  [4mtar‐
1782get[24m [4m...[24m]
1783             A combination of ‘[1m.else[22m’ followed by ‘[1m.if‐
1784make[22m’.
1785
1786     [1m.elifnmake [22m[!][4mtarget[24m [[4moperator[24m  [4mtar‐
1787get[24m [4m...[24m]
1788             A   combination   of   ‘[1m.else[22m’   followed  by
1789‘[1m.ifnmake[22m’.
1790
1791     [1m.endif  [22mEnd the body of the conditional.
1792
1793     The [4moperator[24m may be any one of the following:
1794
1795     [1m||     [22mLogical OR.
1796
1797     [1m&&     [22mLogical AND; of higher precedence than "||".
1798
1799     As in C, [1mbmake [22mwill only evaluate  a  conditional  as
1800far as is necessary to
1801     determine  its value.  Parentheses may be used to change the
1802order of
1803     evaluation.  The boolean operator ‘[1m![22m’ may be used  to
1804logically negate an
1805     entire   conditional.   It  is  of  higher  precedence  than
1806‘[1m&&[22m’.
1807
1808     The value of [4mexpression[24m may be any of the following:
1809
1810     [1mdefined  [22mTakes a variable name  as  an  argument  and
1811evaluates to true if
1812              the variable has been defined.
1813
1814     [1mmake     [22mTakes a target name as an argument and eval‐
1815uates to true if the
1816              target was specified as part of [1mbmake[22m’s com‐
1817mand line or was de‐
1818              clared the default target (either implicitly or ex‐
1819plicitly, see
1820              [4m.MAIN[24m) before the line containing the condi‐
1821tional.
1822
1823     [1mempty     [22mTakes  a variable, with possible modifiers,
1824and evaluates to true
1825              if the expansion of the variable would result in an
1826empty
1827              string.
1828
1829     [1mexists    [22mTakes a file name as an argument and evalu‐
1830ates to true if the
1831              file exists.  The file is searched for on the  sys‐
1832tem search path
1833              (see [4m.PATH[24m).
1834
1835     [1mtarget   [22mTakes a target name as an argument and eval‐
1836uates to true if the
1837              target has been defined.
1838
1839     [1mcommands[0m
1840              Takes a target name as an argument and evaluates to
1841true if the
1842              target has been defined and has commands associated
1843with it.
1844
1845     [4mExpression[24m may also be an arithmetic or  string  com‐
1846parison.  Variable ex‐
1847     pansion  is performed on both sides of the comparison, after
1848which the nu‐
1849     merical values are compared.   A  value  is  interpreted  as
1850hexadecimal if it
1851     is  preceded  by  0x, otherwise it is decimal; octal numbers
1852are not sup‐
1853     ported.  The standard C relational operators  are  all  sup‐
1854ported.  If after
1855     variable  expansion, either the left or right hand side of a
1856‘[1m==[22m’ or ‘[1m!=[22m’
1857     operator is not a numerical value, then string comparison is
1858performed
1859     between  the  expanded variables.  If no relational operator
1860is given, it
1861     is assumed that the  expanded  variable  is  being  compared
1862against 0, or an
1863     empty string in the case of a string comparison.
1864
1865     When [1mbmake [22mis evaluating one of these conditional ex‐
1866pressions, and it en‐
1867     counters a (white‐space separated) word  it  doesn’t  recog‐
1868nize, either the
1869     "make"  or  "defined" expression is applied to it, depending
1870on the form of
1871     the conditional.  If the form is ‘[1m.ifdef[22m’,  ‘[1m.ifn‐
1872def[22m’, or ‘[1m.if[22m’ the
1873     "defined"  expression is applied.  Similarly, if the form is
1874‘[1m.ifmake[22m’ or
1875     ‘[1m.ifnmake[22m’, the "make" expression is applied.
1876
1877     If the conditional evaluates to  true  the  parsing  of  the
1878makefile contin‐
1879     ues  as  before.   If  it  evaluates to false, the following
1880lines are
1881     skipped.    In   both   cases   this   continues   until   a
1882‘[1m.else[22m’ or ‘[1m.endif[22m’ is
1883     found.
1884
1885     For  loops  are  typically used to apply a set of rules to a
1886list of files.
1887     The syntax of a for loop is:
1888
1889     [1m.for  [4m[22mvariable[24m  [[4mvariable[24m   [4m...[24m]
1890[1min [4m[22mexpression[0m
1891     <make‐lines>
1892     [1m.endfor[0m
1893
1894     After  the  for  [1mexpression [22mis evaluated, it is split
1895into words.  On each
1896     iteration of the loop, one word is  taken  and  assigned  to
1897each [1mvariable[22m,
1898     in  order,  and  these [1mvariables [22mare substituted into
1899the [1mmake‐lines [22minside
1900     the body of the for loop.  The number of words must come out
1901even; that
1902     is,  if  there  are three iteration variables, the number of
1903words provided
1904     must be a multiple of three.
1905
1906[1mCOMMENTS[0m
1907     Comments begin with a hash (‘#’) character, anywhere but  in
1908a shell com‐
1909     mand line, and continue to the end of an unescaped new line.
1910
1911[1mSPECIAL SOURCES (ATTRIBUTES)[0m
1912     [1m.EXEC     [22mTarget is never out of date, but always ex‐
1913ecute commands any‐
1914               way.
1915
1916     [1m.IGNORE   [22mIgnore any errors from the commands associ‐
1917ated with this tar‐
1918               get,  exactly  as  if  they all were preceded by a
1919dash (‘‐’).
1920
1921     [1m.MADE     [22mMark all sources of this  target  as  being
1922up‐to‐date.
1923
1924     [1m.MAKE      [22mExecute  the commands associated with this
1925target even if the [1m‐n[0m
1926               or [1m‐t  [22moptions  were  specified.   Normally
1927used to mark recursive
1928               [1mbmake[22ms.
1929
1930     [1m.META      [22mCreate a meta file for the target, even if
1931it is flagged as
1932               [1m.PHONY[22m, [1m.MAKE[22m,  or  [1m.SPECIAL[22m.
1933Usage in conjunction with [1m.MAKE [22mis
1934               the  most likely case.  In "meta" mode, the target
1935is out‐of‐
1936               date if the meta file is missing.
1937
1938     [1m.NOMETA   [22mDo not create a meta file for  the  target.
1939Meta files are also
1940               not  created  for  [1m.PHONY[22m, [1m.MAKE[22m, or
1941[1m.SPECIAL [22mtargets.
1942
1943     [1m.NOMETA_CMP[0m
1944               Ignore differences in commands  when  deciding  if
1945target is out
1946               of date.  This is useful if the command contains a
1947value which
1948               always changes.  If the number of commands change,
1949though, the
1950               target will still be out of date.  The same effect
1951applies to
1952               any command line that uses  the  variable  [4m.OO‐
1953DATE[24m, which can be
1954               used  for  that  purpose  even  when not otherwise
1955needed or de‐
1956               sired:
1957
1958
1959                     skip‐compare‐for‐some:
1960                             @echo this will be compared
1961                             @echo   this   will    not    ${.OO‐
1962DATE:M.NOMETA_CMP}
1963                             @echo this will also be compared
1964
1965               The  [1m:M [22mpattern suppresses any expansion of
1966the unwanted vari‐
1967               able.
1968
1969     [1m.NOPATH   [22mDo not search for the target in the  direc‐
1970tories specified by
1971               [1m.PATH[22m.
1972
1973     [1m.NOTMAIN   [22mNormally  [1mbmake  [22mselects  the first
1974target it encounters as the
1975               default target to be built if no target was speci‐
1976fied.  This
1977               source prevents this target from being selected.
1978
1979     [1m.OPTIONAL[0m
1980               If  a  target  is  marked  with this attribute and
1981[1mbmake [22mcan’t fig‐
1982               ure out how to create it, it will ignore this fact
1983and assume
1984               the file isn’t needed or already exists.
1985
1986     [1m.PHONY    [22mThe target does not correspond to an actual
1987file; it is always
1988               considered to be out of date, and will not be cre‐
1989ated with the
1990               [1m‐t [22moption.  Suffix‐transformation rules are
1991not applied to
1992               [1m.PHONY [22mtargets.
1993
1994     [1m.PRECIOUS[0m
1995               When [1mbmake [22mis interrupted, it normally  re‐
1996moves any partially
1997               made  targets.   This  source  prevents the target
1998from being re‐
1999               moved.
2000
2001     [1m.RECURSIVE[0m
2002               Synonym for [1m.MAKE[22m.
2003
2004     [1m.SILENT   [22mDo not echo any of the commands  associated
2005with this target,
2006               exactly as if they all were preceded by an at sign
2007(‘@’).
2008
2009     [1m.USE      [22mTurn the target into [1mbmake[22m’s version
2010of a macro.  When the tar‐
2011               get  is  used  as a source for another target, the
2012other target
2013               acquires the  commands,  sources,  and  attributes
2014(except for
2015               [1m.USE[22m) of the source.  If the target already
2016has commands, the
2017               [1m.USE  [22mtarget’s  commands  are  appended  to
2018them.
2019
2020     [1m.USEBEFORE[0m
2021               Exactly like [1m.USE[22m, but prepend the [1m.USE‐
2022BEFORE [22mtarget commands
2023               to the target.
2024
2025     [1m.WAIT     [22mIf [1m.WAIT  [22mappears  in  a  dependency
2026line, the sources that precede
2027               it  are made before the sources that succeed it in
2028the line.
2029               Since the dependents of files are not  made  until
2030the file it‐
2031               self could be made, this also stops the dependents
2032being built
2033               unless they are needed for another branch  of  the
2034dependency
2035               tree.  So given:
2036
2037               x: a .WAIT b
2038                       echo x
2039               a:
2040                       echo a
2041               b: b1
2042                       echo b
2043               b1:
2044                       echo b1
2045
2046               the output is always ‘a’, ‘b1’, ‘b’, ‘x’.
2047               The ordering imposed by [1m.WAIT [22mis only rele‐
2048vant for parallel
2049               makes.
2050
2051[1mSPECIAL TARGETS[0m
2052     Special targets may not be included with other targets, i.e.
2053they must be
2054     the only target specified.
2055
2056     [1m.BEGIN    [22mAny  command  lines attached to this target
2057are executed before
2058              anything else is done.
2059
2060     [1m.DEFAULT[0m
2061              This is sort of a [1m.USE [22mrule for  any  target
2062(that was used only
2063              as a source) that [1mbmake [22mcan’t figure out any
2064other way to cre‐
2065              ate.  Only the shell script is used.  The  [1m.IMP‐
2066SRC [22mvariable of a
2067              target  that inherits [1m.DEFAULT[22m’s commands is
2068set to the target’s
2069              own name.
2070
2071     [1m.DELETE_ON_ERROR[0m
2072              If this target is present in the makefile, it glob‐
2073ally causes
2074              make  to  delete  targets whose commands fail.  (By
2075default, only
2076              targets whose commands are interrupted during  exe‐
2077cution are
2078              deleted.   This  is the historical behavior.)  This
2079setting can be
2080              used to help  prevent  half‐finished  or  malformed
2081targets from be‐
2082              ing left around and corrupting future rebuilds.
2083
2084     [1m.END      [22mAny  command  lines attached to this target
2085are executed after ev‐
2086              erything else is done.
2087
2088     [1m.ERROR   [22mAny command lines attached  to  this  target
2089are executed when an‐
2090              other target fails.  The [1m.ERROR_TARGET [22mvari‐
2091able is set to the
2092              target      that      failed.        See       also
2093[1mMAKE_PRINT_VAR_ON_ERROR[22m.
2094
2095     [1m.IGNORE  [22mMark each of the sources with the [1m.IGNORE
2096[22mattribute.  If no
2097              sources are specified, this is  the  equivalent  of
2098specifying the
2099              [1m‐i [22moption.
2100
2101     [1m.INTERRUPT[0m
2102              If  [1mbmake  [22mis  interrupted, the commands for
2103this target will be
2104              executed.
2105
2106     [1m.MAIN    [22mIf no  target  is  specified  when  [1mbmake
2107[22mis invoked, this target
2108              will be built.
2109
2110     [1m.MAKEFLAGS[0m
2111              This  target  provides  a  way to specify flags for
2112[1mbmake [22mwhen the
2113              makefile is used.  The flags are as if typed to the
2114shell,
2115              though the [1m‐f [22moption will have no effect.
2116
2117     [1m.NOPATH   [22mApply  the  [1m.NOPATH [22mattribute to any
2118specified sources.
2119
2120     [1m.NOTPARALLEL[0m
2121              Disable parallel mode.
2122
2123     [1m.NO_PARALLEL[0m
2124              Synonym for [1m.NOTPARALLEL[22m, for  compatibility
2125with other pmake
2126              variants.
2127
2128     [1m.OBJDIR   [22mThe  source  is  a  new  value for ‘[4m.OB‐
2129JDIR[24m’.  If it exists, [1mbmake[0m
2130              will  chdir(2)  to  it  and  update  the  value  of
2131‘[4m.OBJDIR[24m’.
2132
2133     [1m.ORDER    [22mThe  named  targets  are  made in sequence.
2134This ordering does not
2135              add targets to the list  of  targets  to  be  made.
2136Since the depen‐
2137              dents of a target do not get built until the target
2138itself could
2139              be built, unless ‘a’ is built by  another  part  of
2140the dependency
2141              graph, the following is a dependency loop:
2142
2143              .ORDER: b a
2144              b: a
2145
2146              The ordering imposed by [1m.ORDER [22mis only rele‐
2147vant for parallel
2148              makes.
2149
2150     [1m.PATH    [22mThe sources are directories which are to  be
2151searched for files
2152              not  found in the current directory.  If no sources
2153are speci‐
2154              fied,  any  previously  specified  directories  are
2155deleted.  If the
2156              source  is the special [1m.DOTLAST [22mtarget, then
2157the current working
2158              directory is searched last.
2159
2160     [1m.PATH.[4m[22msuffix[0m
2161              Like [1m.PATH [22mbut applies only to files with  a
2162particular suffix.
2163              The  suffix must have been previously declared with
2164[1m.SUFFIXES[22m.
2165
2166     [1m.PHONY   [22mApply the  [1m.PHONY  [22mattribute  to  any
2167specified sources.
2168
2169     [1m.PRECIOUS[0m
2170              Apply  the [1m.PRECIOUS [22mattribute to any speci‐
2171fied sources.  If no
2172              sources are  specified,  the  [1m.PRECIOUS  [22mat‐
2173tribute is applied to ev‐
2174              ery target in the file.
2175
2176     [1m.SHELL   [22mSets the shell that [1mbmake [22mwill use to
2177execute commands.  The
2178              sources are a set of [4mfield=value[24m pairs.
2179
2180              [4mname[24m        This is the  minimal  specifica‐
2181tion, used to select
2182                          one   of   the  built‐in  shell  specs;
2183[4msh[24m, [4mksh[24m, and [4mcsh[24m.
2184
2185              [4mpath[24m        Specifies the path to the shell.
2186
2187              [4mhasErrCtl[24m   Indicates whether the shell sup‐
2188ports exit on error.
2189
2190              [4mcheck[24m        The  command  to  turn on error
2191checking.
2192
2193              [4mignore[24m      The  command  to  disable  error
2194checking.
2195
2196              [4mecho[24m         The  command to turn on echoing
2197of commands executed.
2198
2199              [4mquiet[24m       The command to turn off  echoing
2200of commands exe‐
2201                          cuted.
2202
2203              [4mfilter[24m      The output to filter after issu‐
2204ing the [4mquiet[24m com‐
2205                          mand.  It  is  typically  identical  to
2206[4mquiet[24m.
2207
2208              [4merrFlag[24m      The  flag  to pass the shell to
2209enable error checking.
2210
2211              [4mechoFlag[24m    The flag to pass  the  shell  to
2212enable command echo‐
2213                          ing.
2214
2215              [4mnewline[24m      The  string literal to pass the
2216shell that results in
2217                          a single newline  character  when  used
2218outside of any
2219                          quoting characters.
2220              Example:
2221
2222              .SHELL:   name=ksh   path=/bin/ksh   hasErrCtl=true
2223check="set ‐e"  ignore="set  +e"                        echo="set
2224‐v"         quiet="set         +v"         filter="set        +v"
2225echoFlag=v errFlag=e newline="’0"
2226
2227     [1m.SILENT  [22mApply the [1m.SILENT  [22mattribute  to  any
2228specified sources.  If no
2229              sources are specified, the [1m.SILENT [22mattribute
2230is applied to every
2231              command in the file.
2232
2233     [1m.STALE   [22mThis target gets run when a dependency  file
2234contains stale en‐
2235              tries,  having  [4m.ALLSRC[24m  set  to the name of
2236that dependency file.
2237
2238     [1m.SUFFIXES[0m
2239              Each source specifies a suffix to [1mbmake[22m.  If
2240no sources are
2241              specified,  any  previously  specified suffixes are
2242deleted.  It
2243              allows the creation of suffix‐transformation rules.
2244
2245              Example:
2246
2247              .SUFFIXES: .o
2248              .c.o:
2249                      cc ‐o ${.TARGET} ‐c ${.IMPSRC}
2250
2251[1mENVIRONMENT[0m
2252     [1mbmake [22muses the following  environment  variables,  if
2253they exist: MACHINE,
2254     MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX,
2255MAKESYSPATH,
2256     PWD, and TMPDIR.
2257
2258     MAKEOBJDIRPREFIX and MAKEOBJDIR may only be set in the envi‐
2259ronment or on
2260     the  command  line to [1mbmake [22mand not as makefile vari‐
2261ables; see the descrip‐
2262     tion of ‘[4m.OBJDIR[24m’ for more details.
2263
2264[1mFILES[0m
2265     .depend        list of dependencies
2266     Makefile       list of dependencies
2267     makefile       list of dependencies
2268     sys.mk         system makefile
2269     /usr/share/mk  system makefile directory
2270
2271[1mCOMPATIBILITY[0m
2272     The basic make syntax is compatible between  different  ver‐
2273sions of make;
2274     however the special variables, variable modifiers and condi‐
2275tionals are
2276     not.
2277
2278   [1mOlder versions[0m
2279     An incomplete list of changes in  older  versions  of  [1mb‐
2280make[22m:
2281
2282     The way that .for loop variables are substituted changed af‐
2283ter NetBSD 5.0
2284     so that they still appear to  be  variable  expansions.   In
2285particular this
2286     stops them being treated as syntax, and removes some obscure
2287problems us‐
2288     ing them in .if statements.
2289
2290     The way that parallel makes are scheduled changed in  NetBSD
22914.0 so that
2292     .ORDER  and  .WAIT apply recursively to the dependent nodes.
2293The algo‐
2294     rithms used may change again in the future.
2295
2296   [1mOther make dialects[0m
2297     Other make dialects (GNU make, SVR4 make, POSIX make,  etc.)
2298do not sup‐
2299     port  most  of  the features of [1mbmake [22mas described in
2300this manual.  Most no‐
2301     tably:
2302
2303           [1m+o   [22mThe [1m.WAIT [22mand [1m.ORDER [22mdeclara‐
2304tions and most functionality per‐
2305               taining  to  parallelization.   (GNU make supports
2306parallelization
2307               but lacks these features needed to control it  ef‐
2308fectively.)
2309
2310           [1m+o    [22mDirectives, including for loops and condi‐
2311tionals and most of
2312               the forms of include files.  (GNU make has its own
2313incompatible
2314               and less powerful syntax for conditionals.)
2315
2316           [1m+o    [22mAll  built‐in  variables that begin with a
2317dot.
2318
2319           [1m+o   [22mMost of the  special  sources  and  targets
2320that begin with a dot,
2321               with   the  notable  exception  of  [1m.PHONY[22m,
2322[1m.PRECIOUS[22m, and [1m.SUFFIXES[22m.
2323
2324           [1m+o   [22mVariable modifiers, except for the
2325                     :old=new
2326               string substitution, which does not portably  sup‐
2327port globbing
2328               with  ‘%’  and historically only works on declared
2329suffixes.
2330
2331           [1m+o   [22mThe [1m$> [22mvariable even  in  its  short
2332form; most makes support this
2333               functionality but its name varies.
2334
2335     Some features are somewhat more portable, such as assignment
2336with [1m+=[22m, [1m?=[22m,
2337     and [1m!=[22m.  The [1m.PATH [22mfunctionality is  based  on
2338an older feature [1mVPATH [22mfound
2339     in GNU make and many versions of SVR4 make; however, histor‐
2340ically its be‐
2341     havior is too ill‐defined (and too buggy) to rely upon.
2342
2343     The [1m$@ [22mand [1m$< [22mvariables are more or less  uni‐
2344versally portable, as is the
2345     [1m$(MAKE)  [22mvariable.   Basic  use  of suffix rules (for
2346files only in the cur‐
2347     rent directory, not trying to chain transformations  togeth‐
2348er, etc.) is
2349     also reasonably portable.
2350
2351[1mSEE ALSO[0m
2352     mkdep(1)
2353
2354[1mHISTORY[0m
2355     [1mbmake  [22mis derived from NetBSD make(1).  It uses auto‐
2356conf to facilitate
2357     portability to other platforms.
2358
2359     A make command appeared in Version 7 AT&T UNIX.   This  make
2360implementation
2361     is  based  on Adam De Boor’s pmake program which was written
2362for Sprite at
2363     Berkeley.  It was designed to be a parallel distributed make
2364running jobs
2365     on different machines using a daemon called "customs".
2366
2367     Historically  the  target/dependency  "FRC" has been used to
2368FoRCe rebuild‐
2369     ing (since the target/dependency does  not  exist...  unless
2370someone creates
2371     an "FRC" file).
2372
2373[1mBUGS[0m
2374     The  make syntax is difficult to parse without actually act‐
2375ing on the
2376     data.  For instance, finding the end  of  a  variable’s  use
2377should involve
2378     scanning each of the modifiers, using the correct terminator
2379for each
2380     field.  In many places make just counts {} and ()  in  order
2381to find the
2382     end of a variable expansion.
2383
2384     There is no way of escaping a space character in a filename.
2385
2386FreeBSD      13.0                         August      3,     2021
2387FreeBSD 13.0
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
Impressum