1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)make.1 8.8 (Berkeley) 6/13/95
40 .Nd maintain program dependencies
43 .Op Fl ABPSXeiknpqrstv
55 .Op Fl x Ar warning_options
56 .Op Ar variable Ns No = Ns Ar value
61 utility is a program designed to simplify the maintenance of other programs.
62 Its input is a list of specifications
63 describing dependency relationships between the generation of
66 First of all, the initial list of specifications will be read
67 from the system makefile,
69 unless inhibited with the
78 the default path to which
79 can be altered via the
89 that can be found in the current directory, object directory (see
91 or search path (see the
94 will be read for the main list of dependency specifications.
95 A different makefile or list of them can be supplied via the
100 can be found in any of the aforesaid locations, it will also be read (see
105 searches for a makefile, its name takes precedence over its location.
108 in the object directory will be favored over
110 in the current directory.
112 The options are as follows:
115 Make archive errors non-fatal, causing
117 to just skip the remainder
118 or all of the archive and continue after printing a message.
120 Try to be backwards compatible by executing a single shell per command and
121 by executing the commands to make the sources of a dependency line in sequence.
122 This is turned on by default unless
125 .It Fl C Ar directory
128 before reading the makefiles or doing anything else.
131 options are specified, each is interpreted relative to the previous one:
132 .Fl C Pa / Fl C Pa etc
138 to be 1, in the global context.
140 Turn on debugging, and specify which portions of
142 are to print debugging information.
145 is one or more of the following:
148 Print all possible debugging information;
149 equivalent to specifying all of the debugging flags.
151 Print debugging information about archive searching and caching.
153 Print debugging information about conditional evaluation.
155 Print debugging information about directory searching and caching.
157 Print debugging information about the execution of for loops.
159 Print the input graph before making anything.
161 Print the input graph after making everything, or before exiting
164 Print debugging information about running multiple shells.
166 Print commands in Makefiles regardless of whether or not they are prefixed
167 by @ or other "quiet" flags.
168 Also known as "loud" behavior.
170 Print debugging information about making targets, including modification
173 Print debugging information about suffix-transformation rules.
175 Print debugging information about target list maintenance.
177 Print debugging information about variable assignment.
180 Specify a variable whose environment value (if any) will override
181 macro assignments within makefiles.
183 Specify that environment values override macro assignments within
184 makefiles for all variables.
186 Specify a makefile to read instead of the default one.
189 is not an absolute pathname,
191 will search for it as described above.
196 standard input is read.
199 options can be supplied,
200 and the makefiles will be read in that order.
201 Unlike the other command-line options,
205 nor pushed down to sub-makes via
207 See below for more details on these variables.
208 .It Fl I Ar directory
209 Specify a directory in which to search for makefiles and included makefiles.
212 options can be specified to form a search path.
213 The system makefile directory (or directories, see the
215 option) is automatically appended at the tail of this path.
217 Ignore non-zero exit of shell commands in the makefile.
218 Equivalent to specifying
220 before each command line in the makefile.
222 Specify the maximum number of jobs that
224 may have running at any one time.
225 Turns compatibility mode off, unless the
227 flag is also specified.
229 Continue processing after errors are encountered, but only on those targets
230 that do not depend on the target whose creation caused the error.
231 .It Fl m Ar directory
232 Specify a directory in which to search for
233 the system makefile and makefiles included via the <...> style.
236 options can be specified to form a search path.
237 This path will override the default system include path,
239 The system include path will always be appended to the search path used
240 for "..."-style inclusions and makefile searches (see the
244 Display the commands that would have been executed, but do not actually
247 Collate the output of a given job and display it only when the job finishes,
248 instead of mixing the output of parallel jobs together.
249 This option has no effect unless
253 Only print the input graph, not executing any commands.
254 The output is the same as
258 only the builtin rules of
263 For multi-job makes, this will cause file banners not to be generated.
265 Do not execute any commands, but exit 0 if the specified targets are
266 up-to-date and 1, otherwise.
268 Do not process the system makefile.
270 Stop processing when an error is encountered.
272 This is needed to negate the
274 option during recursive builds.
276 Do not echo any commands as they are executed.
277 Equivalent to specifying
279 before each command line in the makefile.
281 Rather than re-building a target as specified in the makefile, create it
282 or update its modification time to make it appear up-to-date.
288 in the global context.
289 Do not build any targets.
290 Multiple instances of this option may be specified;
291 the variables will be printed one per line,
292 with a blank line for each null or undefined variable.
297 then the value will be expanded before printing.
300 Print any extra information.
304 option to print the values of variables,
305 do not recursively expand the values.
306 .It Ar variable Ns No = Ns Ar value
307 Set the value of the variable
311 .It Fl x Ar warning_options
312 Specify extended warning options.
313 This option may be specified several times.
318 in which case the warning is switched off.
319 The currently available options are:
320 .Bl -tag -width indent
322 Warn if anything except blanks and comments follows an
334 There are seven different types of lines in a makefile: file dependency
335 specifications, shell commands, variable assignments, include statements,
336 conditional directives, for loops, and comments.
338 In general, lines may be continued from one line to the next by ending
339 them with a backslash
341 The trailing newline character and initial whitespace on the following
342 line are compressed into a single space.
343 .Sh FILE DEPENDENCY SPECIFICATIONS
344 Dependency lines consist of one or more targets, an operator, and zero
346 This creates a relationship where the targets
349 and are usually created from them.
350 The exact relationship between the target and the source is determined
351 by the operator that separates them.
352 The three operators are as follows:
355 A target is considered out-of-date if its modification time is less than
356 those of any of its sources.
357 Sources for a target accumulate over dependency lines when this operator
359 The target is removed if
363 Targets are always re-created, but not until all sources have been
364 examined and re-created as necessary.
365 Sources for a target accumulate over dependency lines when this operator
367 The target is removed if
371 If no sources are specified, the target is always re-created.
372 Otherwise, a target is considered out-of-date if any of its sources has
373 been modified more recently than the target.
374 Sources for a target do not accumulate over dependency lines when this
376 The target will not be removed if
381 Targets and sources may contain the shell wildcard expressions
392 may only be used as part of the final
393 component of the target or source, and must be used to describe existing
397 need not necessarily be used to describe existing files.
398 Expansion is in directory order, not alphabetically as done in the shell.
400 Each target may have associated with it a series of shell commands, normally
401 used to create the target.
402 Each of the commands in this script
404 be preceded by a tab.
405 While any target may appear on a dependency line, only one of these
406 dependencies may be followed by a creation script, unless the
410 If the first characters of the command line are
415 the command is treated specially.
418 causes the command not to be echoed before it is executed.
421 causes any non-zero exit status of the command line to be ignored.
424 causes the command to be executed even if
426 is specified on the command line.
427 .Sh VARIABLE ASSIGNMENTS
430 are much like variables in the shell, and, by tradition,
431 consist of all upper-case letters.
432 The five operators that can be used to assign values to variables are as
436 Assign the value to the variable.
437 Any previous value is overridden.
439 Append the value to the current value of the variable.
441 Assign the value to the variable if it is not already defined.
443 Assign with expansion, i.e., expand the value before assigning it
445 Normally, expansion is not done until the variable is referenced.
447 Expand the value and pass it to the shell for execution and assign
448 the result to the variable.
449 Any newlines in the result are replaced with spaces.
452 Any whitespace before the assigned
454 is removed; if the value is being appended, a single space is inserted
455 between the previous contents of the variable and the appended value.
457 Variables are expanded by surrounding the variable name with either
462 and preceding it with
465 If the variable name contains only a single letter, the surrounding
466 braces or parentheses are not required.
467 This shorter form is not recommended.
469 Variable substitution occurs at two distinct times, depending on where
470 the variable is being used.
471 Variables in dependency lines are expanded as the line is read.
472 Variables in shell commands are expanded when the shell command is
475 The four different classes of variables (in order of increasing precedence)
478 .It Environment variables
479 Variables defined as part of
483 Variables defined in the makefile or in included makefiles.
484 .It Command line variables
485 Variables defined as part of the command line and variables
488 environment variable or the
492 Variables that are defined specific to a certain target.
495 If the name of an environment variable appears in a makefile
496 on the left-hand side of an assignment,
497 a global variable with the same name is created, and the latter
498 shadows the former as per their relative precedences.
499 The environment is not changed in this case, and the change
500 is not exported to programs executed by
502 However, a command-line variable actually replaces
503 the environment variable of the same name if the latter exists,
504 which is visible to child programs.
506 There are seven local variables in
508 .Bl -tag -width ".ARCHIVE"
510 The list of all sources for this target; also known as
513 The name of the archive file; also known as
516 The name/path of the source from which the target is to be transformed
519 source); also known as
522 The name of the archive member; also known as
525 The list of sources for this target that were deemed out-of-date; also
529 The file prefix of the file, containing only the file portion, no suffix
530 or preceding directory components; also known as
533 The name of the target; also known as
546 are permitted for backward
547 compatibility and are not recommended.
557 permitted for compatibility with
559 makefiles and are not recommended.
561 Four of the local variables may be used in sources on dependency lines
562 because they expand to the proper value for each target on the line.
572 sets or knows about the following internal variables or environment
574 .Bl -tag -width ".Va .MAKEFILE_LIST"
580 expands to a single dollar
586 .Pq Va argv Ns Op 0 .
588 A path to the directory where
595 to the canonical path given by
598 A path to the directory where the targets are built.
601 searches for an alternate directory to place target files.
602 It will attempt to change into this special directory
603 and will search this directory for makefiles
604 not found in the current directory.
605 The following directories are tried in order:
609 ${MAKEOBJDIRPREFIX}/`pwd -P`
620 The first directory that
622 successfully changes into is used.
627 is set in the environment but
629 is unable to change into the corresponding directory,
630 then the current directory is used
631 without checking the remainder of the list.
632 If they are undefined and
634 is unable to change into any of the remaining three directories,
635 then the current directory is used.
640 must be environment variables and should not be set on
648 to the canonical path given by
650 .It Va .MAKEFILE_LIST
653 reads various makefiles, including the default files and any
654 obtained from the command line and
658 directives, their names will be automatically appended to the
661 They are added right before
663 begins to parse them, so that the name of the current makefile is the
664 last word in this variable.
666 The environment variable
668 may initially contain anything that
675 After processing, its contents are stored in the
677 global variable, although any
680 Then all options and variable assignments specified on
682 command line, except for
690 executes a program, it sets
692 in the program's environment to the current value of the
699 environment contains any
701 options, they will not be pushed down to child programs automatically.
704 utility effectively filters out
706 options from the environment and command line although it
707 passes the rest of its options down to sub-makes via
711 When passing macro definitions and flag arguments in the
713 environment variable,
714 space and tab characters are quoted by preceding them with a backslash.
717 variable from the environment,
718 all sequences of a backslash and one of space or tab
719 are replaced just with their second character
720 without causing a word break.
721 Any other occurrences of a backslash are retained.
722 Groups of unquoted space, tab and newline characters cause word
725 Initially, this global variable contains
727 current run-time options from the environment
728 and command line as described above, under
730 By modifying the contents of the
732 global variable, the makefile can alter the contents of the
734 environment variable made available for all programs which
742 is just copied verbatim to
744 in the environment of child programs.
746 Note that any options entered to
748 neither affect the current instance of
750 nor show up in its own copy of
753 However, they do show up in the
755 environment variable of programs executed by
757 On the other hand, a direct assignment to
759 neither affects the current instance of
761 nor is passed down to
766 special target below.
768 This variable is provided for backward compatibility and
769 contains all the options from the
771 environment variable plus any options specified on
778 The parent process-id of
780 .It Va .MAKE.JOB.PREFIX
785 then output for each target is prefixed with a token
787 the first part of which can be controlled via
788 .Va .MAKE.JOB.PREFIX .
791 .Li .MAKE.JOB.PREFIX=${.newline}---${MAKE:T}[${.MAKE.PID}]
792 would produce tokens like
793 .Ql ---make[1234] target ---
795 .Li .MAKE.JOB.PREFIX=---pid[${.MAKE.PID}],ppid[${.MAKE.PPID}]
796 would produce tokens like
797 .Ql ---pid[56789],ppid[1234] target ---
798 making it easier to track the degree of parallelism being achieved.
802 is currently building.
812 Name of the machine architecture
814 is running on, obtained from the
816 environment variable, or through
820 Name of the machine architecture
822 was compiled for, defined at compilation time.
824 Makefiles may assign a colon-delimited list of directories to
826 These directories will be searched for source files by
828 after it has finished parsing all input makefiles.
831 Variable expansion may be modified to select or modify each word of the
834 is whitespace-delimited sequence of characters).
835 The general format of a variable expansion is as follows:
837 .Dl {variable[:modifier[:...]]}
839 Each modifier begins with a colon and one of the following
841 The colon may be escaped with a backslash
845 .It Cm C No / Ar pattern Xo
850 Modify each word of the value,
851 substituting every match of the extended regular expression
859 Normally, the first occurrence of the pattern in
860 each word of the value is changed.
863 modifier causes the substitution to apply to at most one word; the
865 modifier causes the substitution to apply to as many instances of the
866 search pattern as occur in the word or words it is found in.
871 are orthogonal; the former specifies whether multiple words are
872 potentially affected, the latter whether multiple substitutions can
873 potentially occur within each affected word.
875 Replaces each word in the variable with its suffix.
877 Replaces each word in the variable with everything but the last component.
879 Converts variable to lower-case letters.
880 .It Cm M Ns Ar pattern
882 Select only those words that match the rest of the modifier.
883 The standard shell wildcard characters
890 The wildcard characters may be escaped with a backslash
892 .It Cm N Ns Ar pattern
895 but selects all words which do not match
896 the rest of the modifier.
898 Order every word in the variable alphabetically.
900 Quotes every shell meta-character in the variable, so that it can be passed
901 safely through recursive invocations of
904 Replaces each word in the variable with everything but its suffix.
906 .It Cm S No / Ar old_string Xo
911 Modify the first occurrence of
913 in each word of the variable's value, replacing it with
917 is appended to the last slash of the pattern, all occurrences
918 in each word are replaced.
924 is anchored at the beginning of each word.
927 ends with a dollar sign
929 it is anchored at the end of each word.
936 Any character may be used as a delimiter for the parts of the modifier
938 The anchoring, ampersand, and delimiter characters may be escaped with a
942 Variable expansion occurs in the normal fashion inside both
946 with the single exception that a backslash is used to prevent the expansion
949 not a preceding dollar sign as is usual.
950 .It Ar old_string=new_string
953 style variable substitution.
954 It must be the last modifier specified.
959 do not contain the pattern matching character
961 then it is assumed that they are
962 anchored at the end of each word, so only suffixes or entire
963 words may be replaced.
971 Replaces each word in the variable with its last component.
973 Converts variable to lower-case letters.
975 Converts variable to upper-case letters.
977 Converts variable to upper-case letters.
980 Remove adjacent duplicate words (like
983 .Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS
984 Directives, conditionals, and for loops reminiscent
985 of the C programming language are provided in
987 All such structures are identified by a line beginning with a single
991 The following directives are supported:
993 .It Ic .include Ar <file>
994 .It Ic .include Ar \*qfile\*q
995 Include the specified makefile.
996 Variables between the angle brackets
997 or double quotes are expanded to form the file name.
999 are used, the included makefile is expected to be in the system
1001 If double quotes are used, the including
1002 makefile's directory and any directories specified using the
1004 option are searched before the system
1006 .It Ic .sinclude Ar <file>
1007 .It Ic .sinclude Ar \*qfile\*q
1010 but silently ignored if the file cannot be found and opened.
1011 .It Ic .undef Ar variable
1012 Un-define the specified global variable.
1013 Only global variables may be un-defined.
1014 .It Ic .error Ar message
1015 Terminate processing of the makefile immediately.
1017 makefile, the line on which the error was encountered and the specified
1018 message are printed to the standard error output and
1020 terminates with exit code 1.
1021 Variables in the message are expanded.
1022 .It Ic .warning Ar message
1023 Emit a warning message.
1024 The filename of the makefile,
1025 the line on which the warning was encountered,
1026 and the specified message are printed to the standard error output.
1027 Variables in the message are expanded.
1030 Conditionals are used to determine which parts of the Makefile
1032 They are used similarly to the conditionals supported
1033 by the C pre-processor.
1034 The following conditionals are supported:
1038 .Oo \&! Oc Ns Ar expression
1039 .Op Ar operator expression ...
1041 Test the value of an expression.
1044 .Oo \&! Oc Ns Ar variable
1045 .Op Ar operator variable ...
1047 Test the value of a variable.
1050 .Oo \&! Oc Ns Ar variable
1051 .Op Ar operator variable ...
1053 Test the value of a variable.
1056 .Oo \&! Oc Ns Ar target
1057 .Op Ar operator target ...
1059 Test the target being built.
1062 .Oo \&! Oc Ns Ar target
1063 .Op Ar operator target ...
1065 Test the target being built.
1067 Reverse the sense of the last conditional.
1070 .Oo \&! Oc Ns Ar expression
1071 .Op Ar operator expression ...
1079 .Oo \&! Oc Ns Ar variable
1080 .Op Ar operator variable ...
1088 .Oo \&! Oc Ns Ar variable
1089 .Op Ar operator variable ...
1097 .Oo \&! Oc Ns Ar target
1098 .Op Ar operator target ...
1106 .Oo \&! Oc Ns Ar target
1107 .Op Ar operator target ...
1114 End the body of the conditional.
1119 may be any one of the following:
1120 .Bl -tag -width "Cm XX"
1127 of higher precedence than
1133 will only evaluate a conditional as far as is necessary to determine
1135 Parentheses may be used to change the order of evaluation.
1136 The boolean operator
1138 may be used to logically negate an entire
1140 It is of higher precedence than
1145 may be any of the following:
1148 Takes a variable name as an argument and evaluates to true if the variable
1151 Takes a target name as an argument and evaluates to true if the target
1152 was specified as part of
1154 command line or was declared the default target (either implicitly or
1157 before the line containing the conditional.
1159 Takes a variable, with possible modifiers, and evaluates to true if
1160 the expansion of the variable would result in an empty string.
1162 Takes a file name as an argument and evaluates to true if the file exists.
1163 The file is searched for on the system search path (see
1166 Takes a target name as an argument and evaluates to true if the target
1172 may also be a numeric or string comparison:
1173 in this case, the left-hand side
1175 a variable expansion, whereas the right-hand side can be a
1176 constant or a variable expansion.
1177 Variable expansion is performed on both sides, after which the resulting
1178 values are compared.
1179 A value is interpreted as hexadecimal if it is
1180 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1182 String comparison can only use the
1186 operators, whereas numeric values (both integer and floating point)
1187 can also be compared using the
1195 If no relational operator (and right-hand value) are given, an implicit
1198 However be very careful in using this feature especially
1199 when the left-hand side variable expansion returns a string.
1203 is evaluating one of these conditional expressions, and it encounters
1204 a word it does not recognize, either the
1208 expression is applied to it, depending on the form of the conditional.
1216 expression is applied.
1217 Similarly, if the form is
1223 expression is applied.
1225 If the conditional evaluates to true the parsing of the makefile continues
1227 If it evaluates to false, the following lines are skipped.
1228 In both cases this continues until a
1234 For loops are typically used to apply a set of rules to a list of files.
1235 The syntax of a for loop is:
1237 .Bl -tag -width indent -compact
1238 .It Ic .for Ar variable Ic in Ar expression
1245 is evaluated, it is split into words.
1249 is successively set to each word, and substituted in the
1251 inside the body of the for loop.
1253 Comments begin with a hash
1255 character, anywhere but in a shell
1256 command line, and continue to the end of the line.
1260 Ignore any errors from the commands associated with this target, exactly
1261 as if they all were preceded by a dash
1264 Execute the commands associated with this target even if the
1268 options were specified.
1269 Normally used to mark recursive
1274 selects the first target it encounters as the default target to be built
1275 if no target was specified.
1276 This source prevents this target from being selected.
1278 If a target is marked with this attribute and
1280 cannot figure out how to create it, it will ignore this fact and assume
1281 the file is not needed or already exists.
1285 is interrupted, it removes any partially made targets.
1286 This source prevents the target from being removed.
1288 Do not echo any of the commands associated with this target, exactly
1289 as if they all were preceded by an at sign
1292 Turn the target into
1295 When the target is used as a source for another target, the other target
1296 acquires the commands, sources, and attributes (except for
1300 If the target already has commands, the
1302 target's commands are appended
1307 source appears in a dependency line, the sources that precede it are
1308 made before the sources that succeed it in the line.
1310 detected and targets that form loops will be silently ignored.
1313 Special targets may not be included with other targets, i.e., they must be
1314 the only target specified.
1317 Any command lines attached to this target are executed before anything
1322 rule for any target (that was used only as a
1325 cannot figure out any other way to create.
1326 Only the shell script is used.
1329 variable of a target that inherits
1332 to the target's own name.
1334 Any command lines attached to this target are executed after everything
1337 Mark each of the sources with the
1340 If no sources are specified, this is the equivalent of specifying the
1344 A list of suffixes that indicate files that can be included in a source
1346 The suffix must have already been declared with
1348 any suffix so declared will have the directories on its search path (see
1352 special variable, each preceded by a
1358 is interrupted, the commands for this target will be executed.
1360 This does for libraries what
1362 does for include files, except that the flag used is
1365 If no target is specified when
1367 is invoked, this target will be built.
1368 This is always set, either
1369 explicitly, or implicitly when
1371 selects the default target, to give the user a way to refer to the default
1372 target on the command line.
1373 .It Ic .MAKEFILEDEPS
1375 .Dq Remaking Makefiles
1376 functionality, as explained in the
1377 .Sx REMAKING MAKEFILES
1380 This target provides a way to specify flags for
1382 when the makefile is used.
1383 The flags are as if typed to the shell, though the
1389 and variable assignments specified as the source
1390 for this target are also appended to the
1393 Please note the difference between this target and the
1395 internal variable: specifying an option or variable
1396 assignment as the source for this target will affect
1398 the current makefile and all processes that
1402 Same as above, for backward compatibility.
1403 .\" XXX: NOT YET!!!!
1404 .\" .It Ic .NOTPARALLEL
1405 .\" The named targets are executed in non parallel mode. If no targets are
1406 .\" specified, then all targets are executed in non parallel mode.
1408 Disable parallel mode.
1410 Same as above, for compatibility with other
1414 The named targets are made in sequence.
1415 .\" XXX: NOT YET!!!!
1416 .\" .It Ic .PARALLEL
1417 .\" The named targets are executed in parallel mode. If no targets are
1418 .\" specified, then all targets are executed in parallel mode.
1420 The sources are directories which are to be searched for files not
1421 found in the current directory.
1422 If no sources are specified, any previously specified directories are
1424 Where possible, use of
1426 is preferred over use of the
1429 .It Ic .PATH\fIsuffix\fR
1430 The sources are directories which are to be searched for suffixed files
1431 not found in the current directory.
1435 first searches the suffixed search path, before reverting to the default
1436 path if the file is not found there.
1437 This form is required for
1445 attribute to any specified sources.
1446 Targets with this attribute are always
1447 considered to be out of date.
1451 behavior to match the applicable
1454 (Note this disables the
1455 .Dq Remaking Makefiles
1460 attribute to any specified sources.
1461 If no sources are specified, the
1463 attribute is applied to every
1466 Select another shell.
1467 The sources of this target have the format
1468 .Ar key Ns = Ns Ar value .
1472 .Bl -tag -width ".Va hasErrCtl"
1474 Specify the path to the new shell.
1476 Specify the name of the new shell.
1477 This may be either one of the three builtin shells (see below) or any
1480 Specify the shell command to turn echoing off.
1482 Specify the shell command to turn echoing on.
1484 Usually shells print the echo off command before turning echoing off.
1485 This is the exact string that will be printed by the shell and is used
1486 to filter the shell output to remove the echo off command.
1488 The shell option that turns echoing on.
1490 The shell option to turn on error checking.
1491 If error checking is on, the shell should exit if a command returns
1494 True if the shell has error control.
1498 is true then this is the shell command to turn error checking on.
1501 is false then this is a command template to echo commands for which error
1502 checking is disabled.
1503 The template must contain a
1508 is true, this is the shell command to turn error checking off.
1511 is false, this is a command template to execute a command so that errors
1513 The template must contain a
1516 This is a string of meta characters of the shell.
1518 This is a string holding all the shell's builtin commands separated by blanks.
1523 strings are used in compat mode.
1524 When a command line contains neither a meta
1525 character nor starts with a shell builtin, it is executed directly without
1527 When one of these strings (or both) is empty all commands are executed
1532 environment variable before executing any command.
1533 This is useful for the Korn-shell
1537 Values that are strings must be surrounded by double quotes.
1538 Boolean values are specified as
1542 (in either case) to mean true.
1543 Any other value is taken to mean false.
1545 There are several uses of the
1550 Selecting one of the builtin shells.
1551 This is done by just specifying the name of the shell with the
1554 It is also possible to modify the parameters of the builtin shell by just
1555 specifying other keywords (except for
1558 Using another executable for one of the builtin shells.
1559 This is done by specifying the path to the executable with the
1562 If the last component is the same as the name of the builtin shell, no
1563 name needs to be specified; if it is different, the name must be given:
1564 .Bd -literal -offset indent
1565 \&.SHELL: path="/usr/local/bin/sh"
1568 selects the builtin shell
1570 but will execute it from
1571 .Pa /usr/local/bin/sh .
1572 Like in the previous case, it is possible to modify parameters of the builtin
1573 shell by just specifying them.
1575 Using an entirely different shell.
1576 This is done by specifying all keywords.
1579 The builtin shells are
1590 it is unwise to specify
1591 .Va name Ns = Ns Qq Li ksh
1592 without also specifying a path.
1596 attribute to any specified sources.
1597 If no sources are specified, the
1599 attribute is applied to every
1600 command in the file.
1602 Each source specifies a suffix to
1604 If no sources are specified, any previous specified suffixes are deleted.
1606 Each source specifies a warning flag as previously described for the
1608 command line option.
1609 Warning flags specified on the command line take precedence over flags
1610 specified in the makefile.
1611 Also, command line warning flags are pushed to sub-makes through the
1613 environment variables so that a warning flag specified on the command
1614 line will influence all sub-makes.
1615 Several flags can be specified on a single
1617 target by separating them with blanks.
1619 .Sh REMAKING MAKEFILES
1620 If the special target
1622 exists in the Makefile,
1625 .Dq Remaking Makefiles
1627 After reading Makefile and all the files that are included using
1631 directives (source Makefiles)
1633 considers each source Makefile as a target and tries to rebuild it.
1634 Both explicit and implicit rules are checked and all source Makefiles
1635 are updated if necessary. If any of the source Makefiles were rebuilt,
1637 restarts from clean state.
1639 To prevent infinite loops the following source Makefile targets are ignored:
1643 targets that have no prerequisites
1654 targets without prerequisites and without commands
1657 When remaking a source Makefile options
1663 (no exec) do not take effect, unless source Makefile is specified
1664 explicitly as a target in
1668 Additionally, system makefiles and
1670 are not considered as Makefiles that can be rebuilt.
1674 utility uses the following environment variables, if they exist:
1680 .Ev MAKEOBJDIRPREFIX .
1682 .Bl -tag -width /usr/share/doc/psd/12.make -compact
1684 list of dependencies
1686 list of dependencies
1688 list of dependencies
1693 .It Pa /usr/share/mk
1694 default system makefile directory
1695 .It Pa /usr/share/doc/psd/12.make
1699 .Ev MAKEOBJDIRPREFIX
1701 .It Pa /etc/make.conf
1706 List all included makefiles in order visited:
1708 .Dl "make -V .MAKEFILE_LIST | tr \e\ \e\en"
1716 This was removed for
1719 The internal variable
1721 is set to the same value as
1723 support for this may be removed in the future.
1729 modifiers will be deprecated
1732 and the more portable (among Pmake decedents)
1736 should be used instead.
1738 Most of the more esoteric features of
1740 should probably be avoided for greater compatibility.
1745 .%T "PMake - A Tutorial"
1748 .Pa /usr/share/doc/psd/12.make
1752 command appeared in PWB UNIX.
1754 The determination of
1756 is contorted to the point of absurdity.
1758 In the presence of several
1762 silently ignores all but the first.
1765 is not set to the default target when
1767 is invoked without a target name and no
1769 special target exists.
1773 in a test is very simple-minded.
1774 Currently, the only form that works is
1775 .Ql .if ${VAR} op something .
1776 For instance, you should write tests as
1777 .Ql .if ${VAR} == "string"
1778 not the other way around, which would give you an error.
1780 For loops are expanded before tests, so a fragment such as:
1781 .Bd -literal -offset indent
1782 \&.for ARCH in ${SHARED_ARCHS}
1783 \&.if ${ARCH} == ${MACHINE}
1789 will not work, and should be rewritten as:
1790 .Bd -literal -offset indent
1791 \&.for ARCH in ${SHARED_ARCHS}
1792 \&.if ${MACHINE} == ${ARCH}
1798 The parsing code is broken with respect to handling a semicolon
1799 after a colon, so a fragment like this will fail:
1800 .Bd -literal -offset indent
1804 \&.for h in ${HDRS:S;^;${.CURDIR}/;}
1809 A trailing backslash in a variable value defined on the command line causes
1810 the delimiting space in the
1812 environment variable to be preceded by that backslash.
1813 That causes a submake to not treat that space as a word delimiter.
1814 Fixing this requires a larger rewrite of the code handling command line
1815 macros and assignments to