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 If a file or directory name in the
248 environment variable) starts with the string
252 will search for the specified file or directory named in the remaining part
253 of the argument string.
254 The search starts with the current directory of the Makefile and then works
255 upward towards the root of the filesystem.
256 If the search is successful,
257 then the resulting directory replaces the
262 If used, this feature allows
264 to easily search in the current source tree for customized sys.mk files
270 that are earlier on the command line affect where
274 Display the commands that would have been executed, but do not actually
277 Collate the output of a given job and display it only when the job finishes,
278 instead of mixing the output of parallel jobs together.
279 This option has no effect unless
283 Only print the input graph, not executing any commands.
284 The output is the same as
288 only the builtin rules of
293 For multi-job makes, this will cause file banners not to be generated.
295 Do not execute any commands, but exit 0 if the specified targets are
296 up-to-date and 1, otherwise.
298 Do not process the system makefile.
300 Stop processing when an error is encountered.
302 This is needed to negate the
304 option during recursive builds.
306 Do not echo any commands as they are executed.
307 Equivalent to specifying
309 before each command line in the makefile.
311 Rather than re-building a target as specified in the makefile, create it
312 or update its modification time to make it appear up-to-date.
318 in the global context.
319 Do not build any targets.
320 Multiple instances of this option may be specified;
321 the variables will be printed one per line,
322 with a blank line for each null or undefined variable.
325 Print any extra information.
329 option to print the values of variables,
330 do not recursively expand the values.
331 .It Ar variable Ns No = Ns Ar value
332 Set the value of the variable
336 .It Fl x Ar warning_options
337 Specify extended warning options.
338 This option may be specified several times.
343 in which case the warning is switched off.
344 The currently available options are:
345 .Bl -tag -width indent
347 Warn if anything except blanks and comments follows an
359 There are seven different types of lines in a makefile: file dependency
360 specifications, shell commands, variable assignments, include statements,
361 conditional directives, for loops, and comments.
363 In general, lines may be continued from one line to the next by ending
364 them with a backslash
366 The trailing newline character and initial whitespace on the following
367 line are compressed into a single space.
368 .Sh FILE DEPENDENCY SPECIFICATIONS
369 Dependency lines consist of one or more targets, an operator, and zero
371 This creates a relationship where the targets
374 and are usually created from them.
375 The exact relationship between the target and the source is determined
376 by the operator that separates them.
377 The three operators are as follows:
380 A target is considered out-of-date if its modification time is less than
381 those of any of its sources.
382 Sources for a target accumulate over dependency lines when this operator
384 The target is removed if
388 Targets are always re-created, but not until all sources have been
389 examined and re-created as necessary.
390 Sources for a target accumulate over dependency lines when this operator
392 The target is removed if
396 If no sources are specified, the target is always re-created.
397 Otherwise, a target is considered out-of-date if any of its sources has
398 been modified more recently than the target.
399 Sources for a target do not accumulate over dependency lines when this
401 The target will not be removed if
406 Targets and sources may contain the shell wildcard expressions
417 may only be used as part of the final
418 component of the target or source, and must be used to describe existing
422 need not necessarily be used to describe existing files.
423 Expansion is in directory order, not alphabetically as done in the shell.
425 Each target may have associated with it a series of shell commands, normally
426 used to create the target.
427 Each of the commands in this script
429 be preceded by a tab.
430 While any target may appear on a dependency line, only one of these
431 dependencies may be followed by a creation script, unless the
435 If the first characters of the command line are
440 the command is treated specially.
443 causes the command not to be echoed before it is executed.
446 causes any non-zero exit status of the command line to be ignored.
449 causes the command to be executed even if
451 is specified on the command line.
452 .Sh VARIABLE ASSIGNMENTS
455 are much like variables in the shell, and, by tradition,
456 consist of all upper-case letters.
457 The five operators that can be used to assign values to variables are as
461 Assign the value to the variable.
462 Any previous value is overridden.
464 Append the value to the current value of the variable.
466 Assign the value to the variable if it is not already defined.
468 Assign with expansion, i.e., expand the value before assigning it
470 Normally, expansion is not done until the variable is referenced.
472 Expand the value and pass it to the shell for execution and assign
473 the result to the variable.
474 Any newlines in the result are replaced with spaces.
477 Any whitespace before the assigned
479 is removed; if the value is being appended, a single space is inserted
480 between the previous contents of the variable and the appended value.
482 Variables are expanded by surrounding the variable name with either
487 and preceding it with
490 If the variable name contains only a single letter, the surrounding
491 braces or parentheses are not required.
492 This shorter form is not recommended.
494 Variable substitution occurs at two distinct times, depending on where
495 the variable is being used.
496 Variables in dependency lines are expanded as the line is read.
497 Variables in shell commands are expanded when the shell command is
500 The four different classes of variables (in order of increasing precedence)
503 .It Environment variables
504 Variables defined as part of
508 Variables defined in the makefile or in included makefiles.
509 .It Command line variables
510 Variables defined as part of the command line and variables
513 environment variable or the
517 Variables that are defined specific to a certain target.
520 If the name of an environment variable appears in a makefile
521 on the left-hand side of an assignment,
522 a global variable with the same name is created, and the latter
523 shadows the former as per their relative precedences.
524 The environment is not changed in this case, and the change
525 is not exported to programs executed by
527 However, a command-line variable actually replaces
528 the environment variable of the same name if the latter exists,
529 which is visible to child programs.
531 There are seven local variables in
533 .Bl -tag -width ".ARCHIVE"
535 The list of all sources for this target; also known as
538 The name of the archive file; also known as
541 The name/path of the source from which the target is to be transformed
544 source); also known as
547 The name of the archive member; also known as
550 The list of sources for this target that were deemed out-of-date; also
554 The file prefix of the file, containing only the file portion, no suffix
555 or preceding directory components; also known as
558 The name of the target; also known as
571 are permitted for backward
572 compatibility and are not recommended.
582 permitted for compatibility with
584 makefiles and are not recommended.
586 Four of the local variables may be used in sources on dependency lines
587 because they expand to the proper value for each target on the line.
597 sets or knows about the following internal variables or environment
599 .Bl -tag -width ".Va .MAKEFILE_LIST"
605 expands to a single dollar
611 .Pq Va argv Ns Op 0 .
613 A path to the directory where
620 to the canonical path given by
623 A path to the directory where the targets are built.
626 searches for an alternate directory to place target files.
627 It will attempt to change into this special directory
628 and will search this directory for makefiles
629 not found in the current directory.
630 The following directories are tried in order:
634 ${MAKEOBJDIRPREFIX}/`pwd`
645 The first directory that
647 successfully changes into is used.
652 is set in the environment but
654 is unable to change into the corresponding directory,
655 then the current directory is used
656 without checking the remainder of the list.
657 If they are undefined and
659 is unable to change into any of the remaining three directories,
660 then the current directory is used.
665 must be environment variables and should not be set on
673 to the canonical path given by
675 .It Va .MAKEFILE_LIST
678 reads various makefiles, including the default files and any
679 obtained from the command line and
683 directives, their names will be automatically appended to the
686 They are added right before
688 begins to parse them, so that the name of the current makefile is the
689 last word in this variable.
691 The environment variable
693 may initially contain anything that
700 After processing, its contents are stored in the
702 global variable, although any
705 Then all options and variable assignments specified on
707 command line, except for
715 executes a program, it sets
717 in the program's environment to the current value of the
724 environment contains any
726 options, they will not be pushed down to child programs automatically.
729 utility effectively filters out
731 options from the environment and command line although it
732 passes the rest of its options down to sub-makes via
736 When passing macro definitions and flag arguments in the
738 environment variable,
739 space and tab characters are quoted by preceding them with a backslash.
742 variable from the environment,
743 all sequences of a backslash and one of space or tab
744 are replaced just with their second character
745 without causing a word break.
746 Any other occurrences of a backslash are retained.
747 Groups of unquoted space, tab and newline characters cause word
750 Initially, this global variable contains
752 current run-time options from the environment
753 and command line as described above, under
755 By modifying the contents of the
757 global variable, the makefile can alter the contents of the
759 environment variable made available for all programs which
767 is just copied verbatim to
769 in the environment of child programs.
771 Note that any options entered to
773 neither affect the current instance of
775 nor show up in its own copy of
778 However, they do show up in the
780 environment variable of programs executed by
782 On the other hand, a direct assignment to
784 neither affects the current instance of
786 nor is passed down to
791 special target below.
793 This variable is provided for backward compatibility and
794 contains all the options from the
796 environment variable plus any options specified on
803 The parent process-id of
805 .It Va .MAKE.JOB.PREFIX
810 then output for each target is prefixed with a token
812 the first part of which can be controlled via
813 .Va .MAKE.JOB.PREFIX .
816 .Li .MAKE.JOB.PREFIX=${.newline}---${MAKE:T}[${.MAKE.PID}]
817 would produce tokens like
818 .Ql ---make[1234] target ---
820 .Li .MAKE.JOB.PREFIX=---pid[${.MAKE.PID}],ppid[${.MAKE.PPID}]
821 would produce tokens like
822 .Ql ---pid[56789],ppid[1234] target ---
823 making it easier to track the degree of parallelism being achieved.
827 is currently building.
837 Name of the machine architecture
839 is running on, obtained from the
841 environment variable, or through
845 Name of the machine architecture
847 was compiled for, defined at compilation time.
849 Makefiles may assign a colon-delimited list of directories to
851 These directories will be searched for source files by
853 after it has finished parsing all input makefiles.
855 .Ss Variable Modifiers
856 Variable expansion may be modified to select or modify each word of the
859 is whitespace-delimited sequence of characters).
860 The general format of a variable expansion is as follows:
862 .Dl {variable[:modifier[:...]]}
864 Each modifier begins with a colon and one of the following
866 The colon may be escaped with a backslash
870 .It Cm :C No / Ar pattern Xo
875 Modify each word of the value,
876 substituting every match of the extended regular expression
884 Normally, the first occurrence of the pattern in
885 each word of the value is changed.
888 modifier causes the substitution to apply to at most one word; the
890 modifier causes the substitution to apply to as many instances of the
891 search pattern as occur in the word or words it is found in.
896 are orthogonal; the former specifies whether multiple words are
897 potentially affected, the latter whether multiple substitutions can
898 potentially occur within each affected word.
900 Replaces each word in the variable with its suffix.
902 Replaces each word in the variable with everything but the last component.
904 Converts variable to lower-case letters.
905 .It Cm :M Ns Ar pattern
906 Select only those words that match the rest of the modifier.
907 The standard shell wildcard characters
914 The wildcard characters may be escaped with a backslash
916 .It Cm :N Ns Ar pattern
919 but selects all words which do not match
920 the rest of the modifier.
922 Order every word in the variable alphabetically.
924 Quotes every shell meta-character in the variable, so that it can be passed
925 safely through recursive invocations of
928 Replaces each word in the variable with everything but its suffix.
930 .It Cm :S No / Ar old_string Xo
935 Modify the first occurrence of
937 in each word of the variable's value, replacing it with
941 is appended to the last slash of the pattern, all occurrences
942 in each word are replaced.
948 is anchored at the beginning of each word.
951 ends with a dollar sign
953 it is anchored at the end of each word.
960 Any character may be used as a delimiter for the parts of the modifier
962 The anchoring, ampersand, and delimiter characters may be escaped with a
966 Variable expansion occurs in the normal fashion inside both
970 with the single exception that a backslash is used to prevent the expansion
973 not a preceding dollar sign as is usual.
974 .It Ar :old_string=new_string
977 style variable substitution.
978 It must be the last modifier specified.
983 do not contain the pattern matching character
985 then it is assumed that they are
986 anchored at the end of each word, so only suffixes or entire
987 words may be replaced.
995 Replaces each word in the variable with its last component.
997 Converts variable to upper-case letters.
999 Remove adjacent duplicate words (like
1002 .Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS
1003 Directives, conditionals, and for loops reminiscent
1004 of the C programming language are provided in
1006 All such structures are identified by a line beginning with a single
1010 The following directives are supported:
1012 .It Ic .include Ar <file>
1013 .It Ic .include Ar \*qfile\*q
1014 Include the specified makefile.
1015 Variables between the angle brackets
1016 or double quotes are expanded to form the file name.
1018 are used, the included makefile is expected to be in the system
1020 If double quotes are used, the including
1021 makefile's directory and any directories specified using the
1023 option are searched before the system
1025 .It Ic .sinclude Ar <file>
1026 .It Ic .sinclude Ar \*qfile\*q
1029 but silently ignored if the file cannot be found and opened.
1030 .It Ic .undef Ar variable
1031 Un-define the specified global variable.
1032 Only global variables may be un-defined.
1033 .It Ic .error Ar message
1034 Terminate processing of the makefile immediately.
1036 makefile, the line on which the error was encountered and the specified
1037 message are printed to the standard error output and
1039 terminates with exit code 1.
1040 Variables in the message are expanded.
1041 .It Ic .warning Ar message
1042 Emit a warning message.
1043 The filename of the makefile,
1044 the line on which the warning was encountered,
1045 and the specified message are printed to the standard error output.
1046 Variables in the message are expanded.
1049 Conditionals are used to determine which parts of the Makefile
1051 They are used similarly to the conditionals supported
1052 by the C pre-processor.
1053 The following conditionals are supported:
1057 .Oo \&! Oc Ns Ar expression
1058 .Op Ar operator expression ...
1060 Test the value of an expression.
1063 .Oo \&! Oc Ns Ar variable
1064 .Op Ar operator variable ...
1066 Test the value of a variable.
1069 .Oo \&! Oc Ns Ar variable
1070 .Op Ar operator variable ...
1072 Test the value of a variable.
1075 .Oo \&! Oc Ns Ar target
1076 .Op Ar operator target ...
1078 Test the target being built.
1081 .Oo \&! Oc Ns Ar target
1082 .Op Ar operator target ...
1084 Test the target being built.
1086 Reverse the sense of the last conditional.
1089 .Oo \&! Oc Ns Ar expression
1090 .Op Ar operator expression ...
1098 .Oo \&! Oc Ns Ar variable
1099 .Op Ar operator variable ...
1107 .Oo \&! Oc Ns Ar variable
1108 .Op Ar operator variable ...
1116 .Oo \&! Oc Ns Ar target
1117 .Op Ar operator target ...
1125 .Oo \&! Oc Ns Ar target
1126 .Op Ar operator target ...
1133 End the body of the conditional.
1138 may be any one of the following:
1139 .Bl -tag -width "Cm XX"
1146 of higher precedence than
1152 will only evaluate a conditional as far as is necessary to determine
1154 Parentheses may be used to change the order of evaluation.
1155 The boolean operator
1157 may be used to logically negate an entire
1159 It is of higher precedence than
1164 may be any of the following:
1167 Takes a variable name as an argument and evaluates to true if the variable
1170 Takes a target name as an argument and evaluates to true if the target
1171 was specified as part of
1173 command line or was declared the default target (either implicitly or
1176 before the line containing the conditional.
1178 Takes a variable, with possible modifiers, and evaluates to true if
1179 the expansion of the variable would result in an empty string.
1181 Takes a file name as an argument and evaluates to true if the file exists.
1182 The file is searched for on the system search path (see
1185 Takes a target name as an argument and evaluates to true if the target
1191 may also be a numeric or string comparison:
1192 in this case, the left-hand side
1194 a variable expansion, whereas the right-hand side can be a
1195 constant or a variable expansion.
1196 Variable expansion is performed on both sides, after which the resulting
1197 values are compared.
1198 A value is interpreted as hexadecimal if it is
1199 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1201 String comparison can only use the
1205 operators, whereas numeric values (both integer and floating point)
1206 can also be compared using the
1214 If no relational operator (and right-hand value) are given, an implicit
1217 However be very careful in using this feature especially
1218 when the left-hand side variable expansion returns a string.
1222 is evaluating one of these conditional expressions, and it encounters
1223 a word it does not recognize, either the
1227 expression is applied to it, depending on the form of the conditional.
1235 expression is applied.
1236 Similarly, if the form is
1242 expression is applied.
1244 If the conditional evaluates to true the parsing of the makefile continues
1246 If it evaluates to false, the following lines are skipped.
1247 In both cases this continues until a
1253 For loops are typically used to apply a set of rules to a list of files.
1254 The syntax of a for loop is:
1256 .Bl -tag -width indent -compact
1257 .It Ic .for Ar variable Ic in Ar expression
1264 is evaluated, it is split into words.
1268 is successively set to each word, and substituted in the
1270 inside the body of the for loop.
1272 Comments begin with a hash
1274 character, anywhere but in a shell
1275 command line, and continue to the end of the line.
1279 Ignore any errors from the commands associated with this target, exactly
1280 as if they all were preceded by a dash
1283 Execute the commands associated with this target even if the
1287 options were specified.
1288 Normally used to mark recursive
1293 selects the first target it encounters as the default target to be built
1294 if no target was specified.
1295 This source prevents this target from being selected.
1297 If a target is marked with this attribute and
1299 cannot figure out how to create it, it will ignore this fact and assume
1300 the file is not needed or already exists.
1304 is interrupted, it removes any partially made targets.
1305 This source prevents the target from being removed.
1307 Do not echo any of the commands associated with this target, exactly
1308 as if they all were preceded by an at sign
1311 Turn the target into
1314 When the target is used as a source for another target, the other target
1315 acquires the commands, sources, and attributes (except for
1319 If the target already has commands, the
1321 target's commands are appended
1326 source appears in a dependency line, the sources that precede it are
1327 made before the sources that succeed it in the line.
1329 detected and targets that form loops will be silently ignored.
1332 Special targets may not be included with other targets, i.e., they must be
1333 the only target specified.
1336 Any command lines attached to this target are executed before anything
1341 rule for any target (that was used only as a
1344 cannot figure out any other way to create.
1345 Only the shell script is used.
1348 variable of a target that inherits
1351 to the target's own name.
1353 Any command lines attached to this target are executed after everything
1356 Mark each of the sources with the
1359 If no sources are specified, this is the equivalent of specifying the
1363 A list of suffixes that indicate files that can be included in a source
1365 The suffix must have already been declared with
1367 any suffix so declared will have the directories on its search path (see
1371 special variable, each preceded by a
1377 is interrupted, the commands for this target will be executed.
1379 This does for libraries what
1381 does for include files, except that the flag used is
1384 If no target is specified when
1386 is invoked, this target will be built.
1387 This is always set, either
1388 explicitly, or implicitly when
1390 selects the default target, to give the user a way to refer to the default
1391 target on the command line.
1392 .It Ic .MAKEFILEDEPS
1394 .Dq Remaking Makefiles
1395 functionality, as explained in the
1396 .Sx REMAKING MAKEFILES
1399 This target provides a way to specify flags for
1401 when the makefile is used.
1402 The flags are as if typed to the shell, though the
1408 and variable assignments specified as the source
1409 for this target are also appended to the
1412 Please note the difference between this target and the
1414 internal variable: specifying an option or variable
1415 assignment as the source for this target will affect
1417 the current makefile and all processes that
1421 Same as above, for backward compatibility.
1422 .\" XXX: NOT YET!!!!
1423 .\" .It Ic .NOTPARALLEL
1424 .\" The named targets are executed in non parallel mode. If no targets are
1425 .\" specified, then all targets are executed in non parallel mode.
1427 Disable parallel mode.
1429 Same as above, for compatibility with other
1433 The named targets are made in sequence.
1434 .\" XXX: NOT YET!!!!
1435 .\" .It Ic .PARALLEL
1436 .\" The named targets are executed in parallel mode. If no targets are
1437 .\" specified, then all targets are executed in parallel mode.
1439 The sources are directories which are to be searched for files not
1440 found in the current directory.
1441 If no sources are specified, any previously specified directories are
1443 Where possible, use of
1445 is preferred over use of the
1448 .It Ic .PATH\fIsuffix\fR
1449 The sources are directories which are to be searched for suffixed files
1450 not found in the current directory.
1454 first searches the suffixed search path, before reverting to the default
1455 path if the file is not found there.
1456 This form is required for
1464 attribute to any specified sources.
1465 Targets with this attribute are always
1466 considered to be out of date.
1470 behavior to match the applicable
1473 (Note this disables the
1474 .Dq Remaking Makefiles
1479 attribute to any specified sources.
1480 If no sources are specified, the
1482 attribute is applied to every
1485 Select another shell.
1486 The sources of this target have the format
1487 .Ar key Ns = Ns Ar value .
1491 .Bl -tag -width ".Va hasErrCtl"
1493 Specify the path to the new shell.
1495 Specify the name of the new shell.
1496 This may be either one of the three builtin shells (see below) or any
1499 Specify the shell command to turn echoing off.
1501 Specify the shell command to turn echoing on.
1503 Usually shells print the echo off command before turning echoing off.
1504 This is the exact string that will be printed by the shell and is used
1505 to filter the shell output to remove the echo off command.
1507 The shell option that turns echoing on.
1509 The shell option to turn on error checking.
1510 If error checking is on, the shell should exit if a command returns
1513 True if the shell has error control.
1517 is true then this is the shell command to turn error checking on.
1520 is false then this is a command template to echo commands for which error
1521 checking is disabled.
1522 The template must contain a
1527 is true, this is the shell command to turn error checking off.
1530 is false, this is a command template to execute a command so that errors
1532 The template must contain a
1535 This is a string of meta characters of the shell.
1537 This is a string holding all the shell's builtin commands separated by blanks.
1542 strings are used in compat mode.
1543 When a command line contains neither a meta
1544 character nor starts with a shell builtin, it is executed directly without
1546 When one of these strings (or both) is empty all commands are executed
1551 environment variable before executing any command.
1552 This is useful for the Korn-shell
1556 Values that are strings must be surrounded by double quotes.
1557 Boolean values are specified as
1561 (in either case) to mean true.
1562 Any other value is taken to mean false.
1564 There are several uses of the
1569 Selecting one of the builtin shells.
1570 This is done by just specifying the name of the shell with the
1573 It is also possible to modify the parameters of the builtin shell by just
1574 specifying other keywords (except for
1577 Using another executable for one of the builtin shells.
1578 This is done by specifying the path to the executable with the
1581 If the last component is the same as the name of the builtin shell, no
1582 name needs to be specified; if it is different, the name must be given:
1583 .Bd -literal -offset indent
1584 \&.SHELL: path="/usr/local/bin/sh"
1587 selects the builtin shell
1589 but will execute it from
1590 .Pa /usr/local/bin/sh .
1591 Like in the previous case, it is possible to modify parameters of the builtin
1592 shell by just specifying them.
1594 Using an entirely different shell.
1595 This is done by specifying all keywords.
1598 The builtin shells are
1609 it is unwise to specify
1610 .Va name Ns = Ns Qq Li ksh
1611 without also specifying a path.
1615 attribute to any specified sources.
1616 If no sources are specified, the
1618 attribute is applied to every
1619 command in the file.
1621 Each source specifies a suffix to
1623 If no sources are specified, any previous specified suffixes are deleted.
1625 Each source specifies a warning flag as previously described for the
1627 command line option.
1628 Warning flags specified on the command line take precedence over flags
1629 specified in the makefile.
1630 Also, command line warning flags are pushed to sub-makes through the
1632 environment variables so that a warning flag specified on the command
1633 line will influence all sub-makes.
1634 Several flags can be specified on a single
1636 target by separating them with blanks.
1638 .Sh REMAKING MAKEFILES
1639 If the special target
1641 exists in the Makefile,
1644 .Dq Remaking Makefiles
1646 After reading Makefile and all the files that are included using
1650 directives (source Makefiles)
1652 considers each source Makefile as a target and tries to rebuild it.
1653 Both explicit and implicit rules are checked and all source Makefiles
1654 are updated if necessary. If any of the source Makefiles were rebuilt,
1656 restarts from clean state.
1658 To prevent infinite loops the following source Makefile targets are ignored:
1662 targets that have no prerequisites
1673 targets without prerequisites and without commands
1676 When remaking a source Makefile options
1682 (no exec) do not take effect, unless source Makefile is specified
1683 explicitly as a target in
1687 Additionally, system makefiles and
1689 are not considered as Makefiles that can be rebuilt.
1693 utility uses the following environment variables, if they exist:
1698 .Ev MAKEOBJDIRPREFIX ,
1702 .Bl -tag -width /usr/share/doc/psd/12.make -compact
1704 list of dependencies
1706 list of dependencies
1708 list of dependencies
1713 .It Pa /usr/share/mk
1714 default system makefile directory
1715 .It Pa /usr/share/doc/psd/12.make
1719 .Ev MAKEOBJDIRPREFIX
1721 .It Pa /etc/make.conf
1726 List all included makefiles in order visited:
1728 .Dl "make -V .MAKEFILE_LIST | tr \e\ \e\en"
1736 This was removed for
1739 The internal variable
1741 is set to the same value as
1743 support for this may be removed in the future.
1745 Most of the more esoteric features of
1747 should probably be avoided for greater compatibility.
1752 .%T "PMake - A Tutorial"
1755 .Pa /usr/share/doc/psd/12.make
1759 command appeared in PWB UNIX.
1761 The determination of
1763 is contorted to the point of absurdity.
1765 In the presence of several
1769 silently ignores all but the first.
1772 is not set to the default target when
1774 is invoked without a target name and no
1776 special target exists.
1780 in a test is very simple-minded.
1781 Currently, the only form that works is
1782 .Ql .if ${VAR} op something .
1783 For instance, you should write tests as
1784 .Ql .if ${VAR} == "string"
1785 not the other way around, which would give you an error.
1787 For loops are expanded before tests, so a fragment such as:
1788 .Bd -literal -offset indent
1789 \&.for ARCH in ${SHARED_ARCHS}
1790 \&.if ${ARCH} == ${MACHINE}
1796 will not work, and should be rewritten as:
1797 .Bd -literal -offset indent
1798 \&.for ARCH in ${SHARED_ARCHS}
1799 \&.if ${MACHINE} == ${ARCH}
1805 The parsing code is broken with respect to handling a semicolon
1806 after a colon, so a fragment like this will fail:
1807 .Bd -literal -offset indent
1811 \&.for h in ${HDRS:S;^;${.CURDIR}/;}
1816 A trailing backslash in a variable value defined on the command line causes
1817 the delimiting space in the
1819 environment variable to be preceded by that backslash.
1820 That causes a submake to not treat that space as a word delimiter.
1821 Fixing this requires a larger rewrite of the code handling command line
1822 macros and assignments to