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