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.
295 Print any extra information.
299 option to print the values of variables,
300 do not recursively expand the values.
301 .It Ar variable Ns No = Ns Ar value
302 Set the value of the variable
306 .It Fl x Ar warning_options
307 Specify extended warning options.
308 This option may be specified several times.
313 in which case the warning is switched off.
314 The currently available options are:
315 .Bl -tag -width indent
317 Warn if anything except blanks and comments follows an
329 There are seven different types of lines in a makefile: file dependency
330 specifications, shell commands, variable assignments, include statements,
331 conditional directives, for loops, and comments.
333 In general, lines may be continued from one line to the next by ending
334 them with a backslash
336 The trailing newline character and initial whitespace on the following
337 line are compressed into a single space.
338 .Sh FILE DEPENDENCY SPECIFICATIONS
339 Dependency lines consist of one or more targets, an operator, and zero
341 This creates a relationship where the targets
344 and are usually created from them.
345 The exact relationship between the target and the source is determined
346 by the operator that separates them.
347 The three operators are as follows:
350 A target is considered out-of-date if its modification time is less than
351 those of any of its sources.
352 Sources for a target accumulate over dependency lines when this operator
354 The target is removed if
358 Targets are always re-created, but not until all sources have been
359 examined and re-created as necessary.
360 Sources for a target accumulate over dependency lines when this operator
362 The target is removed if
366 If no sources are specified, the target is always re-created.
367 Otherwise, a target is considered out-of-date if any of its sources has
368 been modified more recently than the target.
369 Sources for a target do not accumulate over dependency lines when this
371 The target will not be removed if
376 Targets and sources may contain the shell wildcard expressions
387 may only be used as part of the final
388 component of the target or source, and must be used to describe existing
392 need not necessarily be used to describe existing files.
393 Expansion is in directory order, not alphabetically as done in the shell.
395 Each target may have associated with it a series of shell commands, normally
396 used to create the target.
397 Each of the commands in this script
399 be preceded by a tab.
400 While any target may appear on a dependency line, only one of these
401 dependencies may be followed by a creation script, unless the
405 If the first characters of the command line are
410 the command is treated specially.
413 causes the command not to be echoed before it is executed.
416 causes any non-zero exit status of the command line to be ignored.
419 causes the command to be executed even if
421 is specified on the command line.
422 .Sh VARIABLE ASSIGNMENTS
425 are much like variables in the shell, and, by tradition,
426 consist of all upper-case letters.
427 The five operators that can be used to assign values to variables are as
431 Assign the value to the variable.
432 Any previous value is overridden.
434 Append the value to the current value of the variable.
436 Assign the value to the variable if it is not already defined.
438 Assign with expansion, i.e., expand the value before assigning it
440 Normally, expansion is not done until the variable is referenced.
442 Expand the value and pass it to the shell for execution and assign
443 the result to the variable.
444 Any newlines in the result are replaced with spaces.
447 Any whitespace before the assigned
449 is removed; if the value is being appended, a single space is inserted
450 between the previous contents of the variable and the appended value.
452 Variables are expanded by surrounding the variable name with either
457 and preceding it with
460 If the variable name contains only a single letter, the surrounding
461 braces or parentheses are not required.
462 This shorter form is not recommended.
464 Variable substitution occurs at two distinct times, depending on where
465 the variable is being used.
466 Variables in dependency lines are expanded as the line is read.
467 Variables in shell commands are expanded when the shell command is
470 The four different classes of variables (in order of increasing precedence)
473 .It Environment variables
474 Variables defined as part of
478 Variables defined in the makefile or in included makefiles.
479 .It Command line variables
480 Variables defined as part of the command line and variables
483 environment variable or the
487 Variables that are defined specific to a certain target.
490 If the name of an environment variable appears in a makefile
491 on the left-hand side of an assignment,
492 a global variable with the same name is created, and the latter
493 shadows the former as per their relative precedences.
494 The environment is not changed in this case, and the change
495 is not exported to programs executed by
497 However, a command-line variable actually replaces
498 the environment variable of the same name if the latter exists,
499 which is visible to child programs.
501 There are seven local variables in
503 .Bl -tag -width ".ARCHIVE"
505 The list of all sources for this target; also known as
508 The name of the archive file; also known as
511 The name/path of the source from which the target is to be transformed
514 source); also known as
517 The name of the archive member; also known as
520 The list of sources for this target that were deemed out-of-date; also
524 The file prefix of the file, containing only the file portion, no suffix
525 or preceding directory components; also known as
528 The name of the target; also known as
541 are permitted for backward
542 compatibility and are not recommended.
552 permitted for compatibility with
554 makefiles and are not recommended.
556 Four of the local variables may be used in sources on dependency lines
557 because they expand to the proper value for each target on the line.
567 sets or knows about the following internal variables or environment
569 .Bl -tag -width ".Va .MAKEFILE_LIST"
575 expands to a single dollar
581 .Pq Va argv Ns Op 0 .
583 A path to the directory where
590 to the canonical path given by
593 A path to the directory where the targets are built.
596 searches for an alternate directory to place target files.
597 It will attempt to change into this special directory
598 and will search this directory for makefiles
599 not found in the current directory.
600 The following directories are tried in order:
604 ${MAKEOBJDIRPREFIX}/`pwd`
615 The first directory that
617 successfully changes into is used.
622 is set in the environment but
624 is unable to change into the corresponding directory,
625 then the current directory is used
626 without checking the remainder of the list.
627 If they are undefined and
629 is unable to change into any of the remaining three directories,
630 then the current directory is used.
635 must be environment variables and should not be set on
643 to the canonical path given by
645 .It Va .MAKEFILE_LIST
648 reads various makefiles, including the default files and any
649 obtained from the command line and
653 directives, their names will be automatically appended to the
656 They are added right before
658 begins to parse them, so that the name of the current makefile is the
659 last word in this variable.
661 The environment variable
663 may initially contain anything that
670 After processing, its contents are stored in the
672 global variable, although any
675 Then all options and variable assignments specified on
677 command line, except for
685 executes a program, it sets
687 in the program's environment to the current value of the
694 environment contains any
696 options, they will not be pushed down to child programs automatically.
699 utility effectively filters out
701 options from the environment and command line although it
702 passes the rest of its options down to sub-makes via
706 When passing macro definitions and flag arguments in the
708 environment variable,
709 space and tab characters are quoted by preceding them with a backslash.
712 variable from the environment,
713 all sequences of a backslash and one of space or tab
714 are replaced just with their second character
715 without causing a word break.
716 Any other occurrences of a backslash are retained.
717 Groups of unquoted space, tab and newline characters cause word
720 Initially, this global variable contains
722 current run-time options from the environment
723 and command line as described above, under
725 By modifying the contents of the
727 global variable, the makefile can alter the contents of the
729 environment variable made available for all programs which
737 is just copied verbatim to
739 in the environment of child programs.
741 Note that any options entered to
743 neither affect the current instance of
745 nor show up in its own copy of
748 However, they do show up in the
750 environment variable of programs executed by
752 On the other hand, a direct assignment to
754 neither affects the current instance of
756 nor is passed down to
761 special target below.
763 This variable is provided for backward compatibility and
764 contains all the options from the
766 environment variable plus any options specified on
773 The parent process-id of
775 .It Va .MAKE.JOB.PREFIX
780 then output for each target is prefixed with a token
782 the first part of which can be controlled via
783 .Va .MAKE.JOB.PREFIX .
786 .Li .MAKE.JOB.PREFIX=${.newline}---${MAKE:T}[${.MAKE.PID}]
787 would produce tokens like
788 .Ql ---make[1234] target ---
790 .Li .MAKE.JOB.PREFIX=---pid[${.MAKE.PID}],ppid[${.MAKE.PPID}]
791 would produce tokens like
792 .Ql ---pid[56789],ppid[1234] target ---
793 making it easier to track the degree of parallelism being achieved.
797 is currently building.
807 Name of the machine architecture
809 is running on, obtained from the
811 environment variable, or through
815 Name of the machine architecture
817 was compiled for, defined at compilation time.
819 Makefiles may assign a colon-delimited list of directories to
821 These directories will be searched for source files by
823 after it has finished parsing all input makefiles.
826 Variable expansion may be modified to select or modify each word of the
829 is whitespace-delimited sequence of characters).
830 The general format of a variable expansion is as follows:
832 .Dl {variable[:modifier[:...]]}
834 Each modifier begins with a colon and one of the following
836 The colon may be escaped with a backslash
840 .It Cm C No / Ar pattern Xo
845 Modify each word of the value,
846 substituting every match of the extended regular expression
854 Normally, the first occurrence of the pattern in
855 each word of the value is changed.
858 modifier causes the substitution to apply to at most one word; the
860 modifier causes the substitution to apply to as many instances of the
861 search pattern as occur in the word or words it is found in.
866 are orthogonal; the former specifies whether multiple words are
867 potentially affected, the latter whether multiple substitutions can
868 potentially occur within each affected word.
870 Replaces each word in the variable with its suffix.
872 Replaces each word in the variable with everything but the last component.
874 Converts variable to lower-case letters.
875 .It Cm M Ns Ar pattern
876 Select only those words that match the rest of the modifier.
877 The standard shell wildcard characters
884 The wildcard characters may be escaped with a backslash
886 .It Cm N Ns Ar pattern
889 but selects all words which do not match
890 the rest of the modifier.
892 Order every word in the variable alphabetically.
894 Quotes every shell meta-character in the variable, so that it can be passed
895 safely through recursive invocations of
898 Replaces each word in the variable with everything but its suffix.
900 .It Cm S No / Ar old_string Xo
905 Modify the first occurrence of
907 in each word of the variable's value, replacing it with
911 is appended to the last slash of the pattern, all occurrences
912 in each word are replaced.
918 is anchored at the beginning of each word.
921 ends with a dollar sign
923 it is anchored at the end of each word.
930 Any character may be used as a delimiter for the parts of the modifier
932 The anchoring, ampersand, and delimiter characters may be escaped with a
936 Variable expansion occurs in the normal fashion inside both
940 with the single exception that a backslash is used to prevent the expansion
943 not a preceding dollar sign as is usual.
944 .It Ar old_string=new_string
947 style variable substitution.
948 It must be the last modifier specified.
953 do not contain the pattern matching character
955 then it is assumed that they are
956 anchored at the end of each word, so only suffixes or entire
957 words may be replaced.
965 Replaces each word in the variable with its last component.
967 Converts variable to upper-case letters.
969 Remove adjacent duplicate words (like
972 .Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS
973 Directives, conditionals, and for loops reminiscent
974 of the C programming language are provided in
976 All such structures are identified by a line beginning with a single
980 The following directives are supported:
982 .It Ic .include Ar <file>
983 .It Ic .include Ar \*qfile\*q
984 Include the specified makefile.
985 Variables between the angle brackets
986 or double quotes are expanded to form the file name.
988 are used, the included makefile is expected to be in the system
990 If double quotes are used, the including
991 makefile's directory and any directories specified using the
993 option are searched before the system
995 .It Ic .sinclude Ar <file>
996 .It Ic .sinclude Ar \*qfile\*q
999 but silently ignored if the file cannot be found and opened.
1000 .It Ic .undef Ar variable
1001 Un-define the specified global variable.
1002 Only global variables may be un-defined.
1003 .It Ic .error Ar message
1004 Terminate processing of the makefile immediately.
1006 makefile, the line on which the error was encountered and the specified
1007 message are printed to the standard error output and
1009 terminates with exit code 1.
1010 Variables in the message are expanded.
1011 .It Ic .warning Ar message
1012 Emit a warning message.
1013 The filename of the makefile,
1014 the line on which the warning was encountered,
1015 and the specified message are printed to the standard error output.
1016 Variables in the message are expanded.
1019 Conditionals are used to determine which parts of the Makefile
1021 They are used similarly to the conditionals supported
1022 by the C pre-processor.
1023 The following conditionals are supported:
1027 .Oo \&! Oc Ns Ar expression
1028 .Op Ar operator expression ...
1030 Test the value of an expression.
1033 .Oo \&! Oc Ns Ar variable
1034 .Op Ar operator variable ...
1036 Test the value of a variable.
1039 .Oo \&! Oc Ns Ar variable
1040 .Op Ar operator variable ...
1042 Test the value of a variable.
1045 .Oo \&! Oc Ns Ar target
1046 .Op Ar operator target ...
1048 Test the target being built.
1051 .Oo \&! Oc Ns Ar target
1052 .Op Ar operator target ...
1054 Test the target being built.
1056 Reverse the sense of the last conditional.
1059 .Oo \&! Oc Ns Ar expression
1060 .Op Ar operator expression ...
1068 .Oo \&! Oc Ns Ar variable
1069 .Op Ar operator variable ...
1077 .Oo \&! Oc Ns Ar variable
1078 .Op Ar operator variable ...
1086 .Oo \&! Oc Ns Ar target
1087 .Op Ar operator target ...
1095 .Oo \&! Oc Ns Ar target
1096 .Op Ar operator target ...
1103 End the body of the conditional.
1108 may be any one of the following:
1109 .Bl -tag -width "Cm XX"
1116 of higher precedence than
1122 will only evaluate a conditional as far as is necessary to determine
1124 Parentheses may be used to change the order of evaluation.
1125 The boolean operator
1127 may be used to logically negate an entire
1129 It is of higher precedence than
1134 may be any of the following:
1137 Takes a variable name as an argument and evaluates to true if the variable
1140 Takes a target name as an argument and evaluates to true if the target
1141 was specified as part of
1143 command line or was declared the default target (either implicitly or
1146 before the line containing the conditional.
1148 Takes a variable, with possible modifiers, and evaluates to true if
1149 the expansion of the variable would result in an empty string.
1151 Takes a file name as an argument and evaluates to true if the file exists.
1152 The file is searched for on the system search path (see
1155 Takes a target name as an argument and evaluates to true if the target
1161 may also be a numeric or string comparison:
1162 in this case, the left-hand side
1164 a variable expansion, whereas the right-hand side can be a
1165 constant or a variable expansion.
1166 Variable expansion is performed on both sides, after which the resulting
1167 values are compared.
1168 A value is interpreted as hexadecimal if it is
1169 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1171 String comparison can only use the
1175 operators, whereas numeric values (both integer and floating point)
1176 can also be compared using the
1184 If no relational operator (and right-hand value) are given, an implicit
1187 However be very careful in using this feature especially
1188 when the left-hand side variable expansion returns a string.
1192 is evaluating one of these conditional expressions, and it encounters
1193 a word it does not recognize, either the
1197 expression is applied to it, depending on the form of the conditional.
1205 expression is applied.
1206 Similarly, if the form is
1212 expression is applied.
1214 If the conditional evaluates to true the parsing of the makefile continues
1216 If it evaluates to false, the following lines are skipped.
1217 In both cases this continues until a
1223 For loops are typically used to apply a set of rules to a list of files.
1224 The syntax of a for loop is:
1226 .Bl -tag -width indent -compact
1227 .It Ic .for Ar variable Ic in Ar expression
1234 is evaluated, it is split into words.
1238 is successively set to each word, and substituted in the
1240 inside the body of the for loop.
1242 Comments begin with a hash
1244 character, anywhere but in a shell
1245 command line, and continue to the end of the line.
1249 Ignore any errors from the commands associated with this target, exactly
1250 as if they all were preceded by a dash
1253 Execute the commands associated with this target even if the
1257 options were specified.
1258 Normally used to mark recursive
1263 selects the first target it encounters as the default target to be built
1264 if no target was specified.
1265 This source prevents this target from being selected.
1267 If a target is marked with this attribute and
1269 cannot figure out how to create it, it will ignore this fact and assume
1270 the file is not needed or already exists.
1274 is interrupted, it removes any partially made targets.
1275 This source prevents the target from being removed.
1277 Do not echo any of the commands associated with this target, exactly
1278 as if they all were preceded by an at sign
1281 Turn the target into
1284 When the target is used as a source for another target, the other target
1285 acquires the commands, sources, and attributes (except for
1289 If the target already has commands, the
1291 target's commands are appended
1296 source appears in a dependency line, the sources that precede it are
1297 made before the sources that succeed it in the line.
1299 detected and targets that form loops will be silently ignored.
1302 Special targets may not be included with other targets, i.e., they must be
1303 the only target specified.
1306 Any command lines attached to this target are executed before anything
1311 rule for any target (that was used only as a
1314 cannot figure out any other way to create.
1315 Only the shell script is used.
1318 variable of a target that inherits
1321 to the target's own name.
1323 Any command lines attached to this target are executed after everything
1326 Mark each of the sources with the
1329 If no sources are specified, this is the equivalent of specifying the
1333 A list of suffixes that indicate files that can be included in a source
1335 The suffix must have already been declared with
1337 any suffix so declared will have the directories on its search path (see
1341 special variable, each preceded by a
1347 is interrupted, the commands for this target will be executed.
1349 This does for libraries what
1351 does for include files, except that the flag used is
1354 If no target is specified when
1356 is invoked, this target will be built.
1357 This is always set, either
1358 explicitly, or implicitly when
1360 selects the default target, to give the user a way to refer to the default
1361 target on the command line.
1362 .It Ic .MAKEFILEDEPS
1364 .Dq Remaking Makefiles
1365 functionality, as explained in the
1366 .Sx REMAKING MAKEFILES
1369 This target provides a way to specify flags for
1371 when the makefile is used.
1372 The flags are as if typed to the shell, though the
1378 and variable assignments specified as the source
1379 for this target are also appended to the
1382 Please note the difference between this target and the
1384 internal variable: specifying an option or variable
1385 assignment as the source for this target will affect
1387 the current makefile and all processes that
1391 Same as above, for backward compatibility.
1392 .\" XXX: NOT YET!!!!
1393 .\" .It Ic .NOTPARALLEL
1394 .\" The named targets are executed in non parallel mode. If no targets are
1395 .\" specified, then all targets are executed in non parallel mode.
1397 Disable parallel mode.
1399 Same as above, for compatibility with other
1403 The named targets are made in sequence.
1404 .\" XXX: NOT YET!!!!
1405 .\" .It Ic .PARALLEL
1406 .\" The named targets are executed in parallel mode. If no targets are
1407 .\" specified, then all targets are executed in parallel mode.
1409 The sources are directories which are to be searched for files not
1410 found in the current directory.
1411 If no sources are specified, any previously specified directories are
1413 Where possible, use of
1415 is preferred over use of the
1418 .It Ic .PATH\fIsuffix\fR
1419 The sources are directories which are to be searched for suffixed files
1420 not found in the current directory.
1424 first searches the suffixed search path, before reverting to the default
1425 path if the file is not found there.
1426 This form is required for
1434 attribute to any specified sources.
1435 Targets with this attribute are always
1436 considered to be out of date.
1440 behavior to match the applicable
1443 (Note this disables the
1444 .Dq Remaking Makefiles
1449 attribute to any specified sources.
1450 If no sources are specified, the
1452 attribute is applied to every
1455 Select another shell.
1456 The sources of this target have the format
1457 .Ar key Ns = Ns Ar value .
1461 .Bl -tag -width ".Va hasErrCtl"
1463 Specify the path to the new shell.
1465 Specify the name of the new shell.
1466 This may be either one of the three builtin shells (see below) or any
1469 Specify the shell command to turn echoing off.
1471 Specify the shell command to turn echoing on.
1473 Usually shells print the echo off command before turning echoing off.
1474 This is the exact string that will be printed by the shell and is used
1475 to filter the shell output to remove the echo off command.
1477 The shell option that turns echoing on.
1479 The shell option to turn on error checking.
1480 If error checking is on, the shell should exit if a command returns
1483 True if the shell has error control.
1487 is true then this is the shell command to turn error checking on.
1490 is false then this is a command template to echo commands for which error
1491 checking is disabled.
1492 The template must contain a
1497 is true, this is the shell command to turn error checking off.
1500 is false, this is a command template to execute a command so that errors
1502 The template must contain a
1505 This is a string of meta characters of the shell.
1507 This is a string holding all the shell's builtin commands separated by blanks.
1512 strings are used in compat mode.
1513 When a command line contains neither a meta
1514 character nor starts with a shell builtin, it is executed directly without
1516 When one of these strings (or both) is empty all commands are executed
1521 environment variable before executing any command.
1522 This is useful for the Korn-shell
1526 Values that are strings must be surrounded by double quotes.
1527 Boolean values are specified as
1531 (in either case) to mean true.
1532 Any other value is taken to mean false.
1534 There are several uses of the
1539 Selecting one of the builtin shells.
1540 This is done by just specifying the name of the shell with the
1543 It is also possible to modify the parameters of the builtin shell by just
1544 specifying other keywords (except for
1547 Using another executable for one of the builtin shells.
1548 This is done by specifying the path to the executable with the
1551 If the last component is the same as the name of the builtin shell, no
1552 name needs to be specified; if it is different, the name must be given:
1553 .Bd -literal -offset indent
1554 \&.SHELL: path="/usr/local/bin/sh"
1557 selects the builtin shell
1559 but will execute it from
1560 .Pa /usr/local/bin/sh .
1561 Like in the previous case, it is possible to modify parameters of the builtin
1562 shell by just specifying them.
1564 Using an entirely different shell.
1565 This is done by specifying all keywords.
1568 The builtin shells are
1579 it is unwise to specify
1580 .Va name Ns = Ns Qq Li ksh
1581 without also specifying a path.
1585 attribute to any specified sources.
1586 If no sources are specified, the
1588 attribute is applied to every
1589 command in the file.
1591 Each source specifies a suffix to
1593 If no sources are specified, any previous specified suffixes are deleted.
1595 Each source specifies a warning flag as previously described for the
1597 command line option.
1598 Warning flags specified on the command line take precedence over flags
1599 specified in the makefile.
1600 Also, command line warning flags are pushed to sub-makes through the
1602 environment variables so that a warning flag specified on the command
1603 line will influence all sub-makes.
1604 Several flags can be specified on a single
1606 target by separating them with blanks.
1608 .Sh REMAKING MAKEFILES
1609 If the special target
1611 exists in the Makefile,
1614 .Dq Remaking Makefiles
1616 After reading Makefile and all the files that are included using
1620 directives (source Makefiles)
1622 considers each source Makefile as a target and tries to rebuild it.
1623 Both explicit and implicit rules are checked and all source Makefiles
1624 are updated if necessary. If any of the source Makefiles were rebuilt,
1626 restarts from clean state.
1628 To prevent infinite loops the following source Makefile targets are ignored:
1632 targets that have no prerequisites
1643 targets without prerequisites and without commands
1646 When remaking a source Makefile options
1652 (no exec) do not take effect, unless source Makefile is specified
1653 explicitly as a target in
1657 Additionally, system makefiles and
1659 are not considered as Makefiles that can be rebuilt.
1663 utility uses the following environment variables, if they exist:
1669 .Ev MAKEOBJDIRPREFIX .
1671 .Bl -tag -width /usr/share/doc/psd/12.make -compact
1673 list of dependencies
1675 list of dependencies
1677 list of dependencies
1682 .It Pa /usr/share/mk
1683 default system makefile directory
1684 .It Pa /usr/share/doc/psd/12.make
1688 .Ev MAKEOBJDIRPREFIX
1690 .It Pa /etc/make.conf
1695 List all included makefiles in order visited:
1697 .Dl "make -V .MAKEFILE_LIST | tr \e\ \e\en"
1705 This was removed for
1708 The internal variable
1710 is set to the same value as
1712 support for this may be removed in the future.
1714 Most of the more esoteric features of
1716 should probably be avoided for greater compatibility.
1721 .%T "PMake - A Tutorial"
1724 .Pa /usr/share/doc/psd/12.make
1728 command appeared in PWB UNIX.
1730 The determination of
1732 is contorted to the point of absurdity.
1734 In the presence of several
1738 silently ignores all but the first.
1741 is not set to the default target when
1743 is invoked without a target name and no
1745 special target exists.
1749 in a test is very simple-minded.
1750 Currently, the only form that works is
1751 .Ql .if ${VAR} op something .
1752 For instance, you should write tests as
1753 .Ql .if ${VAR} == "string"
1754 not the other way around, which would give you an error.
1756 For loops are expanded before tests, so a fragment such as:
1757 .Bd -literal -offset indent
1758 \&.for ARCH in ${SHARED_ARCHS}
1759 \&.if ${ARCH} == ${MACHINE}
1765 will not work, and should be rewritten as:
1766 .Bd -literal -offset indent
1767 \&.for ARCH in ${SHARED_ARCHS}
1768 \&.if ${MACHINE} == ${ARCH}
1774 The parsing code is broken with respect to handling a semicolon
1775 after a colon, so a fragment like this will fail:
1776 .Bd -literal -offset indent
1780 \&.for h in ${HDRS:S;^;${.CURDIR}/;}
1785 A trailing backslash in a variable value defined on the command line causes
1786 the delimiting space in the
1788 environment variable to be preceded by that backslash.
1789 That causes a submake to not treat that space as a word delimiter.
1790 Fixing this requires a larger rewrite of the code handling command line
1791 macros and assignments to