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
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 Do not execute any commands, but exit 0 if the specified targets are
254 up-to-date and 1, otherwise.
256 Do not process the system makefile.
258 Stop processing when an error is encountered.
260 This is needed to negate the
262 option during recursive builds.
264 Do not echo any commands as they are executed.
265 Equivalent to specifying
267 before each command line in the makefile.
269 Rather than re-building a target as specified in the makefile, create it
270 or update its modification time to make it appear up-to-date.
276 in the global context.
277 Do not build any targets.
278 Multiple instances of this option may be specified;
279 the variables will be printed one per line,
280 with a blank line for each null or undefined variable.
283 For multi-job makes, this will cause file banners to be generated.
287 option to print the values of variables,
288 do not recursively expand the values.
289 .It Ar variable Ns No = Ns Ar value
290 Set the value of the variable
294 .It Fl x Ar warning_options
295 Specify extended warning options.
296 This option may be specified several times.
301 in which case the warning is switched off.
302 The currently available options are:
303 .Bl -tag -width indent
305 Warn if anything except blanks and comments follows an
317 There are seven different types of lines in a makefile: file dependency
318 specifications, shell commands, variable assignments, include statements,
319 conditional directives, for loops, and comments.
321 In general, lines may be continued from one line to the next by ending
322 them with a backslash
324 The trailing newline character and initial whitespace on the following
325 line are compressed into a single space.
326 .Sh FILE DEPENDENCY SPECIFICATIONS
327 Dependency lines consist of one or more targets, an operator, and zero
329 This creates a relationship where the targets
332 and are usually created from them.
333 The exact relationship between the target and the source is determined
334 by the operator that separates them.
335 The three operators are as follows:
338 A target is considered out-of-date if its modification time is less than
339 those of any of its sources.
340 Sources for a target accumulate over dependency lines when this operator
342 The target is removed if
346 Targets are always re-created, but not until all sources have been
347 examined and re-created as necessary.
348 Sources for a target accumulate over dependency lines when this operator
350 The target is removed if
354 If no sources are specified, the target is always re-created.
355 Otherwise, a target is considered out-of-date if any of its sources has
356 been modified more recently than the target.
357 Sources for a target do not accumulate over dependency lines when this
359 The target will not be removed if
364 Targets and sources may contain the shell wildcard expressions
375 may only be used as part of the final
376 component of the target or source, and must be used to describe existing
380 need not necessarily be used to describe existing files.
381 Expansion is in directory order, not alphabetically as done in the shell.
383 Each target may have associated with it a series of shell commands, normally
384 used to create the target.
385 Each of the commands in this script
387 be preceded by a tab.
388 While any target may appear on a dependency line, only one of these
389 dependencies may be followed by a creation script, unless the
393 If the first characters of the command line are
398 the command is treated specially.
401 causes the command not to be echoed before it is executed.
404 causes any non-zero exit status of the command line to be ignored.
407 causes the command to be executed even if
409 is specified on the command line.
410 .Sh VARIABLE ASSIGNMENTS
413 are much like variables in the shell, and, by tradition,
414 consist of all upper-case letters.
415 The five operators that can be used to assign values to variables are as
419 Assign the value to the variable.
420 Any previous value is overridden.
422 Append the value to the current value of the variable.
424 Assign the value to the variable if it is not already defined.
426 Assign with expansion, i.e., expand the value before assigning it
428 Normally, expansion is not done until the variable is referenced.
430 Expand the value and pass it to the shell for execution and assign
431 the result to the variable.
432 Any newlines in the result are replaced with spaces.
435 Any whitespace before the assigned
437 is removed; if the value is being appended, a single space is inserted
438 between the previous contents of the variable and the appended value.
440 Variables are expanded by surrounding the variable name with either
445 and preceding it with
448 If the variable name contains only a single letter, the surrounding
449 braces or parentheses are not required.
450 This shorter form is not recommended.
452 Variable substitution occurs at two distinct times, depending on where
453 the variable is being used.
454 Variables in dependency lines are expanded as the line is read.
455 Variables in shell commands are expanded when the shell command is
458 The four different classes of variables (in order of increasing precedence)
461 .It Environment variables
462 Variables defined as part of
466 Variables defined in the makefile or in included makefiles.
467 .It Command line variables
468 Variables defined as part of the command line and variables
471 environment variable or the
475 Variables that are defined specific to a certain target.
478 If the name of an environment variable appears in a makefile
479 on the left-hand side of an assignment,
480 a global variable with the same name is created, and the latter
481 shadows the former as per their relative precedences.
482 The environment is not changed in this case, and the change
483 is not exported to programs executed by
485 However, a command-line variable actually replaces
486 the environment variable of the same name if the latter exists,
487 which is visible to child programs.
489 There are seven local variables in
491 .Bl -tag -width ".ARCHIVE"
493 The list of all sources for this target; also known as
496 The name of the archive file; also known as
499 The name/path of the source from which the target is to be transformed
502 source); also known as
505 The name of the archive member; also known as
508 The list of sources for this target that were deemed out-of-date; also
512 The file prefix of the file, containing only the file portion, no suffix
513 or preceding directory components; also known as
516 The name of the target; also known as
529 are permitted for backward
530 compatibility and are not recommended.
540 permitted for compatibility with
542 makefiles and are not recommended.
544 Four of the local variables may be used in sources on dependency lines
545 because they expand to the proper value for each target on the line.
555 sets or knows about the following internal variables or environment
557 .Bl -tag -width ".Va .MAKEFILE_LIST"
563 expands to a single dollar
569 .Pq Va argv Ns Op 0 .
571 A path to the directory where
578 to the canonical path given by
581 A path to the directory where the targets are built.
584 searches for an alternate directory to place target files.
585 It will attempt to change into this special directory
586 and will search this directory for makefiles
587 not found in the current directory.
588 The following directories are tried in order:
592 ${MAKEOBJDIRPREFIX}/`pwd`
603 The first directory that
605 successfully changes into is used.
610 is set in the environment but
612 is unable to change into the corresponding directory,
613 then the current directory is used
614 without checking the remainder of the list.
615 If they are undefined and
617 is unable to change into any of the remaining three directories,
618 then the current directory is used.
623 must be environment variables and should not be set on
631 to the canonical path given by
633 .It Va .MAKEFILE_LIST
636 reads various makefiles, including the default files and any
637 obtained from the command line and
641 directives, their names will be automatically appended to the
644 They are added right before
646 begins to parse them, so that the name of the current makefile is the
647 last word in this variable.
649 The environment variable
651 may contain anything that
658 Its contents are stored in
662 All options and variable assignments specified on
664 command line, except for
668 variable which is then
669 entered into the environment as
671 for all programs which
675 By modifying the contents of the
677 variable, a makefile can alter the contents of the
679 environment variable made available for all programs which
682 (This includes adding or modifying
685 Note that any options entered to
687 neither affect the current instance of
689 nor show up in its own copy of
692 However, they do show up in the
694 environment variable of programs executed by
696 On the other hand, a direct assignment to
698 neither affects the current instance of
700 nor is passed down to
705 special target below.
707 To sum up what was said on
711 and affect the current
713 at the same time only if inherited from
725 but it is never transferred to
729 When passing macro definitions and flag arguments in the
731 environment variable,
732 space and tab characters are quoted by preceding them with a backslash.
735 variable from the environment,
736 all sequences of a backslash and one of space or tab
737 are replaced just with their second character
738 without causing a word break.
739 Any other occurrences of a backslash are retained.
740 Groups of unquoted space, tab and newline characters cause word
743 This variable is provided for backward compatibility and
744 contains all the options from the
746 environment variable plus any options specified on
752 is currently building.
762 Name of the machine architecture
764 is running on, obtained from the
766 environment variable, or through
770 Name of the machine architecture
772 was compiled for, defined at compilation time.
774 Makefiles may assign a colon-delimited list of directories to
776 These directories will be searched for source files by
778 after it has finished parsing all input makefiles.
781 Variable expansion may be modified to select or modify each word of the
784 is whitespace-delimited sequence of characters).
785 The general format of a variable expansion is as follows:
787 .Dl {variable[:modifier[:...]]}
789 Each modifier begins with a colon and one of the following
791 The colon may be escaped with a backslash
795 .It Cm C No / Ar pattern Xo
800 Modify each word of the value,
801 substituting every match of the extended regular expression
809 Normally, the first occurrence of the pattern in
810 each word of the value is changed.
813 modifier causes the substitution to apply to at most one word; the
815 modifier causes the substitution to apply to as many instances of the
816 search pattern as occur in the word or words it is found in.
821 are orthogonal; the former specifies whether multiple words are
822 potentially affected, the latter whether multiple substitutions can
823 potentially occur within each affected word.
825 Replaces each word in the variable with its suffix.
827 Replaces each word in the variable with everything but the last component.
829 Converts variable to lower-case letters.
830 .It Cm M Ns Ar pattern
831 Select only those words that match the rest of the modifier.
832 The standard shell wildcard characters
839 The wildcard characters may be escaped with a backslash
841 .It Cm N Ns Ar pattern
844 but selects all words which do not match
845 the rest of the modifier.
847 Order every word in the variable alphabetically.
849 Quotes every shell meta-character in the variable, so that it can be passed
850 safely through recursive invocations of
853 Replaces each word in the variable with everything but its suffix.
855 .It Cm S No / Ar old_string Xo
860 Modify the first occurrence of
862 in each word of the variable's value, replacing it with
866 is appended to the last slash of the pattern, all occurrences
867 in each word are replaced.
873 is anchored at the beginning of each word.
876 ends with a dollar sign
878 it is anchored at the end of each word.
885 Any character may be used as a delimiter for the parts of the modifier
887 The anchoring, ampersand, and delimiter characters may be escaped with a
891 Variable expansion occurs in the normal fashion inside both
895 with the single exception that a backslash is used to prevent the expansion
898 not a preceding dollar sign as is usual.
899 .It Ar old_string=new_string
902 style variable substitution.
903 It must be the last modifier specified.
908 do not contain the pattern matching character
910 then it is assumed that they are
911 anchored at the end of each word, so only suffixes or entire
912 words may be replaced.
920 Replaces each word in the variable with its last component.
922 Converts variable to upper-case letters.
924 Remove adjacent duplicate words (like
927 .Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS
928 Directives, conditionals, and for loops reminiscent
929 of the C programming language are provided in
931 All such structures are identified by a line beginning with a single
935 The following directives are supported:
937 .It Ic .include Ar <file>
938 .It Ic .include Ar \*qfile\*q
939 Include the specified makefile.
940 Variables between the angle brackets
941 or double quotes are expanded to form the file name.
943 are used, the included makefile is expected to be in the system
945 If double quotes are used, the including
946 makefile's directory and any directories specified using the
948 option are searched before the system
950 .It Ic .sinclude Ar <file>
951 .It Ic .sinclude Ar \*qfile\*q
954 but silently ignored if the file cannot be found and opened.
955 .It Ic .undef Ar variable
956 Un-define the specified global variable.
957 Only global variables may be un-defined.
958 .It Ic .error Ar message
959 Terminate processing of the makefile immediately.
961 makefile, the line on which the error was encountered and the specified
962 message are printed to the standard error output and
964 terminates with exit code 1.
965 Variables in the message are expanded.
966 .It Ic .warning Ar message
967 Emit a warning message.
968 The filename of the makefile,
969 the line on which the warning was encountered,
970 and the specified message are printed to the standard error output.
971 Variables in the message are expanded.
974 Conditionals are used to determine which parts of the Makefile
976 They are used similarly to the conditionals supported
977 by the C pre-processor.
978 The following conditionals are supported:
982 .Oo \&! Oc Ns Ar expression
983 .Op Ar operator expression ...
985 Test the value of an expression.
988 .Oo \&! Oc Ns Ar variable
989 .Op Ar operator variable ...
991 Test the value of a variable.
994 .Oo \&! Oc Ns Ar variable
995 .Op Ar operator variable ...
997 Test the value of a variable.
1000 .Oo \&! Oc Ns Ar target
1001 .Op Ar operator target ...
1003 Test the target being built.
1006 .Oo \&! Oc Ns Ar target
1007 .Op Ar operator target ...
1009 Test the target being built.
1011 Reverse the sense of the last conditional.
1014 .Oo \&! Oc Ns Ar expression
1015 .Op Ar operator expression ...
1023 .Oo \&! Oc Ns Ar variable
1024 .Op Ar operator variable ...
1032 .Oo \&! Oc Ns Ar variable
1033 .Op Ar operator variable ...
1041 .Oo \&! Oc Ns Ar target
1042 .Op Ar operator target ...
1050 .Oo \&! Oc Ns Ar target
1051 .Op Ar operator target ...
1058 End the body of the conditional.
1063 may be any one of the following:
1064 .Bl -tag -width "Cm XX"
1071 of higher precedence than
1077 will only evaluate a conditional as far as is necessary to determine
1079 Parentheses may be used to change the order of evaluation.
1080 The boolean operator
1082 may be used to logically negate an entire
1084 It is of higher precedence than
1089 may be any of the following:
1092 Takes a variable name as an argument and evaluates to true if the variable
1095 Takes a target name as an argument and evaluates to true if the target
1096 was specified as part of
1098 command line or was declared the default target (either implicitly or
1101 before the line containing the conditional.
1103 Takes a variable, with possible modifiers, and evaluates to true if
1104 the expansion of the variable would result in an empty string.
1106 Takes a file name as an argument and evaluates to true if the file exists.
1107 The file is searched for on the system search path (see
1110 Takes a target name as an argument and evaluates to true if the target
1116 may also be an arithmetic or string comparison, with the left-hand side
1117 being a variable expansion.
1118 Variable expansion is
1119 performed on both sides of the comparison, after which the integral
1120 values are compared.
1121 A value is interpreted as hexadecimal if it is
1122 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1123 The standard C relational operators are all supported.
1125 variable expansion, either the left or right hand side of a
1129 operator is not an integral value, then
1130 string comparison is performed between the expanded
1132 If no relational operator is given, it is assumed that the expanded
1133 variable is being compared against 0.
1137 is evaluating one of these conditional expressions, and it encounters
1138 a word it does not recognize, either the
1142 expression is applied to it, depending on the form of the conditional.
1150 expression is applied.
1151 Similarly, if the form is
1157 expression is applied.
1159 If the conditional evaluates to true the parsing of the makefile continues
1161 If it evaluates to false, the following lines are skipped.
1162 In both cases this continues until a
1168 For loops are typically used to apply a set of rules to a list of files.
1169 The syntax of a for loop is:
1171 .Bl -tag -width indent -compact
1172 .It Ic .for Ar variable Ic in Ar expression
1179 is evaluated, it is split into words.
1183 is successively set to each word, and substituted in the
1185 inside the body of the for loop.
1187 Comments begin with a hash
1189 character, anywhere but in a shell
1190 command line, and continue to the end of the line.
1194 Ignore any errors from the commands associated with this target, exactly
1195 as if they all were preceded by a dash
1198 Execute the commands associated with this target even if the
1202 options were specified.
1203 Normally used to mark recursive
1208 selects the first target it encounters as the default target to be built
1209 if no target was specified.
1210 This source prevents this target from being selected.
1212 If a target is marked with this attribute and
1214 cannot figure out how to create it, it will ignore this fact and assume
1215 the file is not needed or already exists.
1219 is interrupted, it removes any partially made targets.
1220 This source prevents the target from being removed.
1222 Do not echo any of the commands associated with this target, exactly
1223 as if they all were preceded by an at sign
1226 Turn the target into
1229 When the target is used as a source for another target, the other target
1230 acquires the commands, sources, and attributes (except for
1234 If the target already has commands, the
1236 target's commands are appended
1241 source appears in a dependency line, the sources that precede it are
1242 made before the sources that succeed it in the line.
1244 detected and targets that form loops will be silently ignored.
1246 .Sh "SPECIAL TARGETS"
1247 Special targets may not be included with other targets, i.e., they must be
1248 the only target specified.
1251 Any command lines attached to this target are executed before anything
1256 rule for any target (that was used only as a
1259 cannot figure out any other way to create.
1260 Only the shell script is used.
1263 variable of a target that inherits
1266 to the target's own name.
1268 Any command lines attached to this target are executed after everything
1271 Mark each of the sources with the
1274 If no sources are specified, this is the equivalent of specifying the
1278 A list of suffixes that indicate files that can be included in a source
1280 The suffix must have already been declared with
1282 any suffix so declared will have the directories on its search path (see
1286 special variable, each preceded by a
1292 is interrupted, the commands for this target will be executed.
1294 This does for libraries what
1296 does for include files, except that the flag used is
1299 If no target is specified when
1301 is invoked, this target will be built.
1302 This is always set, either
1303 explicitly, or implicitly when
1305 selects the default target, to give the user a way to refer to the default
1306 target on the command line.
1308 This target provides a way to specify flags for
1310 when the makefile is used.
1311 The flags are as if typed to the shell, though the
1317 and variable assignments specified as the source
1318 for this target are also appended to the
1321 Please note the difference between this target and the
1323 internal variable: specifying an option or variable
1324 assignment as the source for this target will affect
1326 the current makefile and all processes that
1330 Same as above, for backward compatibility.
1331 .\" XXX: NOT YET!!!!
1332 .\" .It Ic .NOTPARALLEL
1333 .\" The named targets are executed in non parallel mode. If no targets are
1334 .\" specified, then all targets are executed in non parallel mode.
1336 Disable parallel mode.
1338 Same as above, for compatibility with other
1342 The named targets are made in sequence.
1343 .\" XXX: NOT YET!!!!
1344 .\" .It Ic .PARALLEL
1345 .\" The named targets are executed in parallel mode. If no targets are
1346 .\" specified, then all targets are executed in parallel mode.
1348 The sources are directories which are to be searched for files not
1349 found in the current directory.
1350 If no sources are specified, any previously specified directories are
1352 Where possible, use of
1354 is preferred over use of the
1357 .It Ic .PATH\fIsuffix\fR
1358 The sources are directories which are to be searched for suffixed files
1359 not found in the current directory.
1363 first searches the suffixed search path, before reverting to the default
1364 path if the file is not found there.
1365 This form is required for
1373 attribute to any specified sources.
1374 Targets with this attribute are always
1375 considered to be out of date.
1379 attribute to any specified sources.
1380 If no sources are specified, the
1382 attribute is applied to every
1385 Select another shell.
1386 The sources of this target have the format
1387 .Ar key Ns = Ns Ar value .
1391 .Bl -tag -width ".Va hasErrCtl"
1393 Specify the path to the new shell.
1395 Specify the name of the new shell.
1396 This may be either one of the three builtin shells (see below) or any
1399 Specify the shell command to turn echoing off.
1401 Specify the shell command to turn echoing on.
1403 Usually shells print the echo off command before turning echoing off.
1404 This is the exact string that will be printed by the shell and is used
1405 to filter the shell output to remove the echo off command.
1407 The shell option that turns echoing on.
1409 The shell option to turn on error checking.
1410 If error checking is on, the shell should exit if a command returns
1413 True if the shell has error control.
1417 is true then this is the shell command to turn error checking on.
1420 is false then this is a command template to echo commands for which error
1421 checking is disabled.
1422 The template must contain a
1427 is true, this is the shell command to turn error checking off.
1430 is false, this is a command template to execute a command so that errors
1432 The template must contain a
1435 This is a string of meta characters of the shell.
1437 This is a string holding all the shell's builtin commands separated by blanks.
1442 strings are used in compat mode.
1443 When a command line contains neither a meta
1444 character nor starts with a shell builtin, it is executed directly without
1446 When one of these strings (or both) is empty all commands are executed
1451 environment variable before executing any command.
1452 This is useful for the Korn-shell
1456 Values that are strings must be surrounded by double quotes.
1457 Boolean values are specified as
1461 (in either case) to mean true.
1462 Any other value is taken to mean false.
1464 There are several uses of the
1469 Selecting one of the builtin shells.
1470 This is done by just specifying the name of the shell with the
1473 It is also possible to modify the parameters of the builtin shell by just
1474 specifying other keywords (except for
1477 Using another executable for one of the builtin shells.
1478 This is done by specifying the path to the executable with the
1481 If the last component is the same as the name of the builtin shell, no
1482 name needs to be specified; if it is different, the name must be given:
1483 .Bd -literal -offset indent
1484 \&.SHELL: path="/usr/local/bin/sh"
1487 selects the builtin shell
1489 but will execute it from
1490 .Pa /usr/local/bin/sh .
1491 Like in the previous case, it is possible to modify parameters of the builtin
1492 shell by just specifying them.
1494 Using an entirely different shell.
1495 This is done by specifying all keywords.
1498 The builtin shells are
1509 it is unwise to specify
1510 .Va name Ns = Ns Qq Li ksh
1511 without also specifying a path.
1515 attribute to any specified sources.
1516 If no sources are specified, the
1518 attribute is applied to every
1519 command in the file.
1521 Each source specifies a suffix to
1523 If no sources are specified, any previous specified suffices are deleted.
1525 Each source specifies a warning flag as previously described for the
1527 command line option.
1528 Warning flags specified on the command line take precedence over flags
1529 specified in the makefile.
1530 Also, command line warning flags are pushed to sub-makes through the
1532 environment variables so that a warning flag specified on the command
1533 line will influence all sub-makes.
1534 Several flags can be specified on a single
1536 target by seperating them with blanks.
1538 .Sh REMAKING MAKEFILES
1539 After reading Makefile and all the files that are included using
1543 directives (source Makefiles)
1545 considers each source Makefile as a target and tries to rebuild it.
1546 Both explicit and implicit rules are checked and all source Makefiles
1547 are updated if necessary. If any of the source Makefiles were rebuilt,
1549 restarts from clean state.
1551 To prevent infinite loops the following source Makefile targets are ignored:
1555 targets that have no prerequisites but have commands
1566 targets without prerequisites and without commands
1569 When remaking a source Makefile options
1575 (no exec) do not take effect, unless source Makefile is specified
1576 explicitly as a target in
1580 Additionally, system makefiles and
1582 are not considered as Makefiles that can be rebuilt.
1586 utility uses the following environment variables, if they exist:
1592 .Ev MAKEOBJDIRPREFIX .
1594 .Bl -tag -width /usr/share/doc/psd/12.make -compact
1596 list of dependencies
1598 list of dependencies
1600 list of dependencies
1605 .It Pa /usr/share/mk
1606 default system makefile directory
1607 .It Pa /usr/share/doc/psd/12.make
1611 .Ev MAKEOBJDIRPREFIX
1613 .It Pa /etc/make.conf
1618 List all included makefiles in order visited:
1620 .Dl "make -V .MAKEFILE_LIST | tr \e\ \e\en"
1628 This was removed for POSIX compatibility.
1629 The internal variable
1631 is set to the same value as
1633 support for this may be removed in the future.
1635 Most of the more esoteric features of
1637 should probably be avoided for greater compatibility.
1642 .%T "PMake - A Tutorial"
1645 .Pa /usr/share/doc/psd/12.make
1649 command appeared in PWB UNIX.
1651 The determination of
1653 is contorted to the point of absurdity.
1655 In the presence of several
1659 silently ignores all but the first.
1662 is not set to the default target when
1664 is invoked without a target name and no
1666 special target exists.
1670 in a test is very simple-minded.
1671 Currently, the only form that works is
1672 .Ql .if ${VAR} op something
1673 For instance, you should write tests as
1674 .Ql .if ${VAR} == "string"
1675 not the other way around, which would give you an error.
1677 For loops are expanded before tests, so a fragment such as:
1678 .Bd -literal -offset indent
1679 \&.for ARCH in ${SHARED_ARCHS}
1680 \&.if ${ARCH} == ${MACHINE}
1686 will not work, and should be rewritten as:
1687 .Bd -literal -offset indent
1688 \&.for ARCH in ${SHARED_ARCHS}
1689 \&.if ${MACHINE} == ${ARCH}
1695 The parsing code is broken with respect to handling a semicolon
1696 after a colon, so a fragment like this will fail:
1697 .Bd -literal -offset indent
1701 \&.for h in ${HDRS:S;^;${.CURDIR}/;}
1706 A trailing backslash in a variable value defined on the command line causes
1707 the delimiting space in the
1709 environment variable to be preceded by that backslash.
1710 That causes a submake to not treat that space as a word delimiter.
1711 Fixing this requires a larger rewrite of the code handling command line
1712 macros and assignments to