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