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 initially contain anything that
658 After processing, its contents are stored in the
660 global variable, although any
663 Then all options and variable assignments specified on
665 command line, except for
673 executes a program, it sets
675 in the program's environment to the current value of the
682 environment contains any
684 options, they will not be pushed down to child programs automatically.
687 utility effectively filters out
689 options from the environment and command line although it
690 passes the rest of its options down to sub-makes via
694 When passing macro definitions and flag arguments in the
696 environment variable,
697 space and tab characters are quoted by preceding them with a backslash.
700 variable from the environment,
701 all sequences of a backslash and one of space or tab
702 are replaced just with their second character
703 without causing a word break.
704 Any other occurrences of a backslash are retained.
705 Groups of unquoted space, tab and newline characters cause word
708 Initially, this global variable contains
710 current run-time options from the environment
711 and command line as described above, under
713 By modifying the contents of the
715 global variable, the makefile can alter the contents of the
717 environment variable made available for all programs which
725 is just copied verbatim to
727 in the environment of child programs.
729 Note that any options entered to
731 neither affect the current instance of
733 nor show up in its own copy of
736 However, they do show up in the
738 environment variable of programs executed by
740 On the other hand, a direct assignment to
742 neither affects the current instance of
744 nor is passed down to
749 special target below.
751 This variable is provided for backward compatibility and
752 contains all the options from the
754 environment variable plus any options specified on
760 is currently building.
770 Name of the machine architecture
772 is running on, obtained from the
774 environment variable, or through
778 Name of the machine architecture
780 was compiled for, defined at compilation time.
782 Makefiles may assign a colon-delimited list of directories to
784 These directories will be searched for source files by
786 after it has finished parsing all input makefiles.
789 Variable expansion may be modified to select or modify each word of the
792 is whitespace-delimited sequence of characters).
793 The general format of a variable expansion is as follows:
795 .Dl {variable[:modifier[:...]]}
797 Each modifier begins with a colon and one of the following
799 The colon may be escaped with a backslash
803 .It Cm C No / Ar pattern Xo
808 Modify each word of the value,
809 substituting every match of the extended regular expression
817 Normally, the first occurrence of the pattern in
818 each word of the value is changed.
821 modifier causes the substitution to apply to at most one word; the
823 modifier causes the substitution to apply to as many instances of the
824 search pattern as occur in the word or words it is found in.
829 are orthogonal; the former specifies whether multiple words are
830 potentially affected, the latter whether multiple substitutions can
831 potentially occur within each affected word.
833 Replaces each word in the variable with its suffix.
835 Replaces each word in the variable with everything but the last component.
837 Converts variable to lower-case letters.
838 .It Cm M Ns Ar pattern
839 Select only those words that match the rest of the modifier.
840 The standard shell wildcard characters
847 The wildcard characters may be escaped with a backslash
849 .It Cm N Ns Ar pattern
852 but selects all words which do not match
853 the rest of the modifier.
855 Order every word in the variable alphabetically.
857 Quotes every shell meta-character in the variable, so that it can be passed
858 safely through recursive invocations of
861 Replaces each word in the variable with everything but its suffix.
863 .It Cm S No / Ar old_string Xo
868 Modify the first occurrence of
870 in each word of the variable's value, replacing it with
874 is appended to the last slash of the pattern, all occurrences
875 in each word are replaced.
881 is anchored at the beginning of each word.
884 ends with a dollar sign
886 it is anchored at the end of each word.
893 Any character may be used as a delimiter for the parts of the modifier
895 The anchoring, ampersand, and delimiter characters may be escaped with a
899 Variable expansion occurs in the normal fashion inside both
903 with the single exception that a backslash is used to prevent the expansion
906 not a preceding dollar sign as is usual.
907 .It Ar old_string=new_string
910 style variable substitution.
911 It must be the last modifier specified.
916 do not contain the pattern matching character
918 then it is assumed that they are
919 anchored at the end of each word, so only suffixes or entire
920 words may be replaced.
928 Replaces each word in the variable with its last component.
930 Converts variable to upper-case letters.
932 Remove adjacent duplicate words (like
935 .Sh DIRECTIVES, CONDITIONALS, AND FOR LOOPS
936 Directives, conditionals, and for loops reminiscent
937 of the C programming language are provided in
939 All such structures are identified by a line beginning with a single
943 The following directives are supported:
945 .It Ic .include Ar <file>
946 .It Ic .include Ar \*qfile\*q
947 Include the specified makefile.
948 Variables between the angle brackets
949 or double quotes are expanded to form the file name.
951 are used, the included makefile is expected to be in the system
953 If double quotes are used, the including
954 makefile's directory and any directories specified using the
956 option are searched before the system
958 .It Ic .sinclude Ar <file>
959 .It Ic .sinclude Ar \*qfile\*q
962 but silently ignored if the file cannot be found and opened.
963 .It Ic .undef Ar variable
964 Un-define the specified global variable.
965 Only global variables may be un-defined.
966 .It Ic .error Ar message
967 Terminate processing of the makefile immediately.
969 makefile, the line on which the error was encountered and the specified
970 message are printed to the standard error output and
972 terminates with exit code 1.
973 Variables in the message are expanded.
974 .It Ic .warning Ar message
975 Emit a warning message.
976 The filename of the makefile,
977 the line on which the warning was encountered,
978 and the specified message are printed to the standard error output.
979 Variables in the message are expanded.
982 Conditionals are used to determine which parts of the Makefile
984 They are used similarly to the conditionals supported
985 by the C pre-processor.
986 The following conditionals are supported:
990 .Oo \&! Oc Ns Ar expression
991 .Op Ar operator expression ...
993 Test the value of an expression.
996 .Oo \&! Oc Ns Ar variable
997 .Op Ar operator variable ...
999 Test the value of a variable.
1002 .Oo \&! Oc Ns Ar variable
1003 .Op Ar operator variable ...
1005 Test the value of a variable.
1008 .Oo \&! Oc Ns Ar target
1009 .Op Ar operator target ...
1011 Test the target being built.
1014 .Oo \&! Oc Ns Ar target
1015 .Op Ar operator target ...
1017 Test the target being built.
1019 Reverse the sense of the last conditional.
1022 .Oo \&! Oc Ns Ar expression
1023 .Op Ar operator expression ...
1031 .Oo \&! Oc Ns Ar variable
1032 .Op Ar operator variable ...
1040 .Oo \&! Oc Ns Ar variable
1041 .Op Ar operator variable ...
1049 .Oo \&! Oc Ns Ar target
1050 .Op Ar operator target ...
1058 .Oo \&! Oc Ns Ar target
1059 .Op Ar operator target ...
1066 End the body of the conditional.
1071 may be any one of the following:
1072 .Bl -tag -width "Cm XX"
1079 of higher precedence than
1085 will only evaluate a conditional as far as is necessary to determine
1087 Parentheses may be used to change the order of evaluation.
1088 The boolean operator
1090 may be used to logically negate an entire
1092 It is of higher precedence than
1097 may be any of the following:
1100 Takes a variable name as an argument and evaluates to true if the variable
1103 Takes a target name as an argument and evaluates to true if the target
1104 was specified as part of
1106 command line or was declared the default target (either implicitly or
1109 before the line containing the conditional.
1111 Takes a variable, with possible modifiers, and evaluates to true if
1112 the expansion of the variable would result in an empty string.
1114 Takes a file name as an argument and evaluates to true if the file exists.
1115 The file is searched for on the system search path (see
1118 Takes a target name as an argument and evaluates to true if the target
1124 may also be an arithmetic or string comparison, with the left-hand side
1125 being a variable expansion.
1126 Variable expansion is
1127 performed on both sides of the comparison, after which the integral
1128 values are compared.
1129 A value is interpreted as hexadecimal if it is
1130 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1131 The standard C relational operators are all supported.
1133 variable expansion, either the left or right hand side of a
1137 operator is not an integral value, then
1138 string comparison is performed between the expanded
1140 If no relational operator is given, it is assumed that the expanded
1141 variable is being compared against 0.
1145 is evaluating one of these conditional expressions, and it encounters
1146 a word it does not recognize, either the
1150 expression is applied to it, depending on the form of the conditional.
1158 expression is applied.
1159 Similarly, if the form is
1165 expression is applied.
1167 If the conditional evaluates to true the parsing of the makefile continues
1169 If it evaluates to false, the following lines are skipped.
1170 In both cases this continues until a
1176 For loops are typically used to apply a set of rules to a list of files.
1177 The syntax of a for loop is:
1179 .Bl -tag -width indent -compact
1180 .It Ic .for Ar variable Ic in Ar expression
1187 is evaluated, it is split into words.
1191 is successively set to each word, and substituted in the
1193 inside the body of the for loop.
1195 Comments begin with a hash
1197 character, anywhere but in a shell
1198 command line, and continue to the end of the line.
1202 Ignore any errors from the commands associated with this target, exactly
1203 as if they all were preceded by a dash
1206 Execute the commands associated with this target even if the
1210 options were specified.
1211 Normally used to mark recursive
1216 selects the first target it encounters as the default target to be built
1217 if no target was specified.
1218 This source prevents this target from being selected.
1220 If a target is marked with this attribute and
1222 cannot figure out how to create it, it will ignore this fact and assume
1223 the file is not needed or already exists.
1227 is interrupted, it removes any partially made targets.
1228 This source prevents the target from being removed.
1230 Do not echo any of the commands associated with this target, exactly
1231 as if they all were preceded by an at sign
1234 Turn the target into
1237 When the target is used as a source for another target, the other target
1238 acquires the commands, sources, and attributes (except for
1242 If the target already has commands, the
1244 target's commands are appended
1249 source appears in a dependency line, the sources that precede it are
1250 made before the sources that succeed it in the line.
1252 detected and targets that form loops will be silently ignored.
1254 .Sh "SPECIAL TARGETS"
1255 Special targets may not be included with other targets, i.e., they must be
1256 the only target specified.
1259 Any command lines attached to this target are executed before anything
1264 rule for any target (that was used only as a
1267 cannot figure out any other way to create.
1268 Only the shell script is used.
1271 variable of a target that inherits
1274 to the target's own name.
1276 Any command lines attached to this target are executed after everything
1279 Mark each of the sources with the
1282 If no sources are specified, this is the equivalent of specifying the
1286 A list of suffixes that indicate files that can be included in a source
1288 The suffix must have already been declared with
1290 any suffix so declared will have the directories on its search path (see
1294 special variable, each preceded by a
1300 is interrupted, the commands for this target will be executed.
1302 This does for libraries what
1304 does for include files, except that the flag used is
1307 If no target is specified when
1309 is invoked, this target will be built.
1310 This is always set, either
1311 explicitly, or implicitly when
1313 selects the default target, to give the user a way to refer to the default
1314 target on the command line.
1315 .It Ic .MAKEFILEDEPS
1317 .Dq Remaking Makefiles
1318 functionality, as explained in the
1319 .Sx REMAKING MAKEFILES
1322 This target provides a way to specify flags for
1324 when the makefile is used.
1325 The flags are as if typed to the shell, though the
1331 and variable assignments specified as the source
1332 for this target are also appended to the
1335 Please note the difference between this target and the
1337 internal variable: specifying an option or variable
1338 assignment as the source for this target will affect
1340 the current makefile and all processes that
1344 Same as above, for backward compatibility.
1345 .\" XXX: NOT YET!!!!
1346 .\" .It Ic .NOTPARALLEL
1347 .\" The named targets are executed in non parallel mode. If no targets are
1348 .\" specified, then all targets are executed in non parallel mode.
1350 Disable parallel mode.
1352 Same as above, for compatibility with other
1356 The named targets are made in sequence.
1357 .\" XXX: NOT YET!!!!
1358 .\" .It Ic .PARALLEL
1359 .\" The named targets are executed in parallel mode. If no targets are
1360 .\" specified, then all targets are executed in parallel mode.
1362 The sources are directories which are to be searched for files not
1363 found in the current directory.
1364 If no sources are specified, any previously specified directories are
1366 Where possible, use of
1368 is preferred over use of the
1371 .It Ic .PATH\fIsuffix\fR
1372 The sources are directories which are to be searched for suffixed files
1373 not found in the current directory.
1377 first searches the suffixed search path, before reverting to the default
1378 path if the file is not found there.
1379 This form is required for
1387 attribute to any specified sources.
1388 Targets with this attribute are always
1389 considered to be out of date.
1393 behavior to match the applicable
1399 attribute to any specified sources.
1400 If no sources are specified, the
1402 attribute is applied to every
1405 Select another shell.
1406 The sources of this target have the format
1407 .Ar key Ns = Ns Ar value .
1411 .Bl -tag -width ".Va hasErrCtl"
1413 Specify the path to the new shell.
1415 Specify the name of the new shell.
1416 This may be either one of the three builtin shells (see below) or any
1419 Specify the shell command to turn echoing off.
1421 Specify the shell command to turn echoing on.
1423 Usually shells print the echo off command before turning echoing off.
1424 This is the exact string that will be printed by the shell and is used
1425 to filter the shell output to remove the echo off command.
1427 The shell option that turns echoing on.
1429 The shell option to turn on error checking.
1430 If error checking is on, the shell should exit if a command returns
1433 True if the shell has error control.
1437 is true then this is the shell command to turn error checking on.
1440 is false then this is a command template to echo commands for which error
1441 checking is disabled.
1442 The template must contain a
1447 is true, this is the shell command to turn error checking off.
1450 is false, this is a command template to execute a command so that errors
1452 The template must contain a
1455 This is a string of meta characters of the shell.
1457 This is a string holding all the shell's builtin commands separated by blanks.
1462 strings are used in compat mode.
1463 When a command line contains neither a meta
1464 character nor starts with a shell builtin, it is executed directly without
1466 When one of these strings (or both) is empty all commands are executed
1471 environment variable before executing any command.
1472 This is useful for the Korn-shell
1476 Values that are strings must be surrounded by double quotes.
1477 Boolean values are specified as
1481 (in either case) to mean true.
1482 Any other value is taken to mean false.
1484 There are several uses of the
1489 Selecting one of the builtin shells.
1490 This is done by just specifying the name of the shell with the
1493 It is also possible to modify the parameters of the builtin shell by just
1494 specifying other keywords (except for
1497 Using another executable for one of the builtin shells.
1498 This is done by specifying the path to the executable with the
1501 If the last component is the same as the name of the builtin shell, no
1502 name needs to be specified; if it is different, the name must be given:
1503 .Bd -literal -offset indent
1504 \&.SHELL: path="/usr/local/bin/sh"
1507 selects the builtin shell
1509 but will execute it from
1510 .Pa /usr/local/bin/sh .
1511 Like in the previous case, it is possible to modify parameters of the builtin
1512 shell by just specifying them.
1514 Using an entirely different shell.
1515 This is done by specifying all keywords.
1518 The builtin shells are
1529 it is unwise to specify
1530 .Va name Ns = Ns Qq Li ksh
1531 without also specifying a path.
1535 attribute to any specified sources.
1536 If no sources are specified, the
1538 attribute is applied to every
1539 command in the file.
1541 Each source specifies a suffix to
1543 If no sources are specified, any previous specified suffices are deleted.
1545 Each source specifies a warning flag as previously described for the
1547 command line option.
1548 Warning flags specified on the command line take precedence over flags
1549 specified in the makefile.
1550 Also, command line warning flags are pushed to sub-makes through the
1552 environment variables so that a warning flag specified on the command
1553 line will influence all sub-makes.
1554 Several flags can be specified on a single
1556 target by seperating them with blanks.
1558 .Sh REMAKING MAKEFILES
1559 If the special target
1561 exists in the Makefile,
1564 .Dq Remaking Makefiles
1566 After reading Makefile and all the files that are included using
1570 directives (source Makefiles)
1572 considers each source Makefile as a target and tries to rebuild it.
1573 Both explicit and implicit rules are checked and all source Makefiles
1574 are updated if necessary. If any of the source Makefiles were rebuilt,
1576 restarts from clean state.
1578 To prevent infinite loops the following source Makefile targets are ignored:
1582 targets that have no prerequisites but have commands
1593 targets without prerequisites and without commands
1596 When remaking a source Makefile options
1602 (no exec) do not take effect, unless source Makefile is specified
1603 explicitly as a target in
1607 Additionally, system makefiles and
1609 are not considered as Makefiles that can be rebuilt.
1613 utility uses the following environment variables, if they exist:
1619 .Ev MAKEOBJDIRPREFIX .
1621 .Bl -tag -width /usr/share/doc/psd/12.make -compact
1623 list of dependencies
1625 list of dependencies
1627 list of dependencies
1632 .It Pa /usr/share/mk
1633 default system makefile directory
1634 .It Pa /usr/share/doc/psd/12.make
1638 .Ev MAKEOBJDIRPREFIX
1640 .It Pa /etc/make.conf
1645 List all included makefiles in order visited:
1647 .Dl "make -V .MAKEFILE_LIST | tr \e\ \e\en"
1655 This was removed for
1658 The internal variable
1660 is set to the same value as
1662 support for this may be removed in the future.
1664 Most of the more esoteric features of
1666 should probably be avoided for greater compatibility.
1671 .%T "PMake - A Tutorial"
1674 .Pa /usr/share/doc/psd/12.make
1678 command appeared in PWB UNIX.
1680 The determination of
1682 is contorted to the point of absurdity.
1684 In the presence of several
1688 silently ignores all but the first.
1691 is not set to the default target when
1693 is invoked without a target name and no
1695 special target exists.
1699 in a test is very simple-minded.
1700 Currently, the only form that works is
1701 .Ql .if ${VAR} op something
1702 For instance, you should write tests as
1703 .Ql .if ${VAR} == "string"
1704 not the other way around, which would give you an error.
1706 For loops are expanded before tests, so a fragment such as:
1707 .Bd -literal -offset indent
1708 \&.for ARCH in ${SHARED_ARCHS}
1709 \&.if ${ARCH} == ${MACHINE}
1715 will not work, and should be rewritten as:
1716 .Bd -literal -offset indent
1717 \&.for ARCH in ${SHARED_ARCHS}
1718 \&.if ${MACHINE} == ${ARCH}
1724 The parsing code is broken with respect to handling a semicolon
1725 after a colon, so a fragment like this will fail:
1726 .Bd -literal -offset indent
1730 \&.for h in ${HDRS:S;^;${.CURDIR}/;}
1735 A trailing backslash in a variable value defined on the command line causes
1736 the delimiting space in the
1738 environment variable to be preceded by that backslash.
1739 That causes a submake to not treat that space as a word delimiter.
1740 Fixing this requires a larger rewrite of the code handling command line
1741 macros and assignments to