Annotation of src/usr.bin/make/make.1, Revision 1.15
1.15 ! thorpej 1: .\" $NetBSD: make.1,v 1.14 1996/03/15 21:52:32 christos Exp $
! 2: .\"
1.1 cgd 3: .\" Copyright (c) 1990 The Regents of the University of California.
4: .\" All rights reserved.
5: .\"
6: .\" Redistribution and use in source and binary forms, with or without
7: .\" modification, are permitted provided that the following conditions
8: .\" are met:
9: .\" 1. Redistributions of source code must retain the above copyright
10: .\" notice, this list of conditions and the following disclaimer.
11: .\" 2. Redistributions in binary form must reproduce the above copyright
12: .\" notice, this list of conditions and the following disclaimer in the
13: .\" documentation and/or other materials provided with the distribution.
14: .\" 3. All advertising materials mentioning features or use of this software
15: .\" must display the following acknowledgement:
16: .\" This product includes software developed by the University of
17: .\" California, Berkeley and its contributors.
18: .\" 4. Neither the name of the University nor the names of its contributors
19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
1.3 mycroft 34: .\" from: @(#)make.1 5.7 (Berkeley) 7/24/91
1.1 cgd 35: .\"
36: .Dd July 24, 1991
37: .Dt MAKE 1
38: .Os
39: .Sh NAME
40: .Nm make
41: .Nd maintain program dependencies
42: .Sh SYNOPSIS
43: .Nm make
1.10 christos 44: .Op Fl Beiknqrstv
1.1 cgd 45: .Op Fl D Ar variable
46: .Op Fl d Ar flags
47: .Op Fl f Ar makefile
48: .Op Fl I Ar directory
49: .Bk -words
50: .Op Fl j Ar max_jobs
1.13 christos 51: .Op Fl m Ar directory
1.1 cgd 52: .Ek
53: .Op Ar variable=value
54: .Op Ar target ...
55: .Sh DESCRIPTION
56: .Nm Make
57: is a program designed to simplify the maintenance of other programs.
58: Its input is a list of specifications as to the files upon which programs
59: and other files depend.
60: If the file
61: .Ql Pa makefile
62: exists, it is read for this list of specifications.
63: If it does not exist, the file
64: .Ql Pa Makefile
65: is read.
66: If the file
67: .Ql Pa .depend
68: exists, it is read (see
69: .Xr mkdep 1) .
70: .Pp
71: This manual page is intended as a reference document only.
72: For a more thorough description of
73: .Nm make
74: and makefiles, please refer to
75: .%T "Make \- A Tutorial" .
76: .Pp
77: The options are as follows:
78: .Bl -tag -width Ds
1.10 christos 79: .It Fl B
80: Try to be backwards compatible by executing a single shell per command and
81: by executing the commands to make the sources of a dependency line in sequence.
1.1 cgd 82: .It Fl D Ar variable
1.8 christos 83: Define
84: .Ar variable
1.1 cgd 85: to be 1, in the global context.
86: .It Fl d Ar flags
87: Turn on debugging, and specify which portions of
88: .Nm make
89: are to print debugging information.
90: .Ar Flags
91: is one or more of the following:
92: .Bl -tag -width Ds
93: .It Ar A
94: Print all possible debugging information;
95: equivalent to specifying all of the debugging flags.
96: .It Ar a
97: Print debugging information about archive searching and caching.
98: .It Ar c
99: Print debugging information about conditional evaluation.
100: .It Ar d
101: Print debugging information about directory searching and caching.
102: .It Ar "g1"
103: Print the input graph before making anything.
104: .It Ar "g2"
105: Print the input graph after making everything, or before exiting
106: on error.
107: .It Ar j
108: Print debugging information about running multiple shells.
109: .It Ar m
110: Print debugging information about making targets, including modification
111: dates.
112: .It Ar s
113: Print debugging information about suffix-transformation rules.
114: .It Ar t
115: Print debugging information about target list maintenance.
116: .It Ar v
117: Print debugging information about variable assignment.
118: .El
119: .It Fl e
120: Specify that environmental variables override macro assignments within
121: makefiles.
122: .It Fl f Ar makefile
123: Specify a makefile to read instead of the default
124: .Ql Pa makefile
125: and
126: .Ql Pa Makefile .
127: If
128: .Ar makefile
129: is
130: .Ql Fl ,
131: standard input is read.
132: Multiple makefile's may be specified, and are read in the order specified.
133: .It Fl I Ar directory
134: Specify a directory in which to search for makefiles and included makefiles.
1.13 christos 135: The system makefile directory (or directories, see the
136: .Fl m
137: option) is automatically included as part of this list.
1.1 cgd 138: .It Fl i
139: Ignore non-zero exit of shell commands in the makefile.
140: Equivalent to specifying
141: .Ql Fl
142: before each command line in the makefile.
143: .It Fl j Ar max_jobs
144: Specify the maximum number of jobs that
145: .Nm make
1.11 christos 146: may have running at any one time. Turns compatibility mode off, unless the
147: .Ar B
148: flag is also specified.
1.1 cgd 149: .It Fl k
150: Continue processing after errors are encountered, but only on those targets
151: that do not depend on the target whose creation caused the error.
1.13 christos 152: .It Fl m Ar directory
153: Specify a directory in which to search for sys.mk and makefiles included
154: via the <...> style. Multiple directories can be added to form a search path.
155: This path will override the default system include path: /usr/share/mk.
156: Furthermore the system include path will be appended to the search path used
157: for "..."-style inclusions (see the
158: .Fl I
159: option).
1.1 cgd 160: .It Fl n
161: Display the commands that would have been executed, but do not actually
162: execute them.
163: .It Fl q
164: Do not execute any commands, but exit 0 if the specified targets are
165: up-to-date and 1, otherwise.
166: .It Fl r
167: Do not use the built-in rules specified in the system makefile.
168: .It Fl s
169: Do not echo any commands as they are executed.
170: Equivalent to specifying
171: .Ql Ic @
172: before each command line in the makefile.
173: .It Fl t
174: Rather than re-building a target as specified in the makefile, create it
175: or update its modification time to make it appear up-to-date.
176: .It Ar variable=value
177: Set the value of the variable
178: .Ar variable
179: to
180: .Ar value .
181: .El
182: .Pp
1.6 cgd 183: There are seven different types of lines in a makefile: file dependency
1.1 cgd 184: specifications, shell commands, variable assignments, include statements,
1.6 cgd 185: conditional directives, for loops, and comments.
1.1 cgd 186: .Pp
187: In general, lines may be continued from one line to the next by ending
188: them with a backslash
189: .Pq Ql \e .
190: The trailing newline character and initial whitespace on the following
191: line are compressed into a single space.
192: .Sh FILE DEPENDENCY SPECIFICATIONS
193: Dependency lines consist of one or more targets, an operator, and zero
194: or more sources.
195: This creates a relationship where the targets ``depend'' on the sources
196: and are usually created from them.
197: The exact relationship between the target and the source is determined
198: by the operator that separates them.
199: The three operators are as follows:
200: .Bl -tag -width flag
201: .It Ic \&:
202: A target is considered out-of-date if its modification time is less than
203: those of any of its sources.
204: Sources for a target accumulate over dependency lines when this operator
205: is used.
206: The target is removed if
207: .Nm make
208: is interrupted.
209: .It Ic \&!
210: Targets are always re-created, but not until all sources have been
211: examined and re-created as necessary.
212: Sources for a target accumulate over dependency lines when this operator
213: is used.
214: The target is removed if
215: .Nm make
216: is interrupted.
217: .It Ic \&::
218: If no sources are specified, the target is always re-created.
219: Otherwise, a target is considered out-of-date if any of its sources has
220: been modified more recently than the target.
221: Sources for a target do not accumulate over dependency lines when this
222: operator is used.
223: The target will not be removed if
224: .Nm make
225: is interrupted.
226: .El
227: .Pp
228: Targets and sources may contain the shell wildcard values
229: .Ql ? ,
230: .Ql * ,
231: .Ql []
232: and
233: .Ql {} .
234: The values
235: .Ql ? ,
236: .Ql *
237: and
238: .Ql []
239: may only be used as part of the final
240: component of the target or source, and must be used to describe existing
241: files.
242: The value
243: .Ql {}
244: need not necessarily be used to describe existing files.
245: Expansion is in directory order, not alphabetically as done in the shell.
246: .Sh SHELL COMMANDS
247: Each target may have associated with it a series of shell commands, normally
248: used to create the target.
249: Each of the commands in this script
250: .Em must
251: be preceded by a tab.
252: While any target may appear on a dependency line, only one of these
253: dependencies may be followed by a creation script, unless the
254: .Ql Ic ::
255: operator is used.
256: .Pp
257: If the first or first two characters of the command line are
258: .Ql Ic @
259: and/or
260: .Ql Ic \- ,
261: the command is treated specially.
262: A
263: .Ql Ic @
264: causes the command not to be echoed before it is executed.
265: A
266: .Ql Ic \-
267: causes any non-zero exit status of the command line to be ignored.
268: .Sh VARIABLE ASSIGNMENTS
269: Variables in make are much like variables in the shell, and, by tradition,
270: consist of all upper-case letters.
271: The five operators that can be used to assign values to variables are as
272: follows:
273: .Bl -tag -width Ds
274: .It Ic \&=
275: Assign the value to the variable.
276: Any previous value is overridden.
277: .It Ic \&+=
278: Append the value to the current value of the variable.
279: .It Ic \&?=
280: Assign the value to the variable if it is not already defined.
281: .It Ic \&:=
282: Assign with expansion, i.e. expand the value before assigning it
283: to the variable.
284: Normally, expansion is not done until the variable is referenced.
285: .It Ic \&!=
286: Expand the value and pass it to the shell for execution and assign
287: the result to the variable.
288: Any newlines in the result are replaced with spaces.
289: .El
290: .Pp
291: Any white-space before the assigned
292: .Ar value
293: is removed; if the value is being appended, a single space is inserted
294: between the previous contents of the variable and the appended value.
295: .Pp
296: Variables are expanded by surrounding the variable name with either
297: curly braces
298: .Pq Ql {}
1.7 mycroft 299: or parentheses
1.1 cgd 300: .Pq Ql ()
301: and preceding it with
302: a dollar sign
303: .Pq Ql \&$ .
304: If the variable name contains only a single letter, the surrounding
1.7 mycroft 305: braces or parentheses are not required.
1.1 cgd 306: This shorter form is not recommended.
307: .Pp
308: Variable substitution occurs at two distinct times, depending on where
309: the variable is being used.
310: Variables in dependency lines are expanded as the line is read.
311: Variables in shell commands are expanded when the shell command is
312: executed.
313: .Pp
314: The four different classes of variables (in order of increasing precedence)
315: are:
316: .Bl -tag -width Ds
317: .It Environment variables
318: Variables defined as part of
319: .Nm make Ns 's
320: environment.
321: .It Global variables
322: Variables defined in the makefile or in included makefiles.
323: .It Command line variables
324: Variables defined as part of the command line.
325: .It Local variables
326: Variables that are defined specific to a certain target.
327: The seven local variables are as follows:
328: .Bl -tag -width ".ARCHIVE"
329: .It Va .ALLSRC
330: The list of all sources for this target; also known as
331: .Ql Va \&> .
332: .It Va .ARCHIVE
333: The name of the archive file.
334: .It Va .IMPSRC
335: The name/path of the source from which the target is to be transformed
336: (the ``implied'' source); also known as
337: .Ql Va \&< .
338: .It Va .MEMBER
339: The name of the archive member.
340: .It Va .OODATE
341: The list of sources for this target that were deemed out-of-date; also
342: known as
343: .Ql Va \&? .
344: .It Va .PREFIX
345: The file prefix of the file, containing only the file portion, no suffix
346: or preceding directory components; also known as
347: .Ql Va * .
348: .It Va .TARGET
349: The name of the target; also known as
350: .Ql Va @ .
351: .El
352: .Pp
353: The shorter forms
354: .Ql Va @ ,
355: .Ql Va ? ,
356: .Ql Va \&>
357: and
358: .Ql Va *
359: are permitted for backward
360: compatibility with historical makefiles and are not recommended.
361: The six variables
362: .Ql Va "@F" ,
363: .Ql Va "@D" ,
364: .Ql Va "<F" ,
365: .Ql Va "<D" ,
366: .Ql Va "*F"
367: and
368: .Ql Va "*D"
369: are
370: permitted for compatibility with
371: .At V
372: makefiles and are not recommended.
373: .Pp
374: Four of the local variables may be used in sources on dependency lines
375: because they expand to the proper value for each target on the line.
376: These variables are
377: .Ql Va .TARGET ,
378: .Ql Va .PREFIX ,
379: .Ql Va .ARCHIVE ,
380: and
381: .Ql Va .MEMBER .
382: .Pp
383: In addition,
384: .Nm make
385: sets or knows about the following variables:
386: .Bl -tag -width MAKEFLAGS
387: .It Va \&$
388: A single dollar sign
389: .Ql \&$ ,
390: i.e.
391: .Ql \&$$
392: expands to a single dollar
393: sign.
394: .It Va .MAKE
395: The name that
396: .Nm make
397: was executed with
398: .Pq Va argv Op 0
399: .It Va .CURDIR
400: A path to the directory where
401: .Nm make
402: was executed.
1.4 pk 403: .It Va .OBJDIR
404: A path to the directory where the targets are built.
1.1 cgd 405: .It Ev MAKEFLAGS
406: The environment variable
407: .Ql Ev MAKEFLAGS
408: may contain anything that
409: may be specified on
410: .Nm make Ns 's
411: command line.
412: Anything specified on
413: .Nm make Ns 's
414: command line is appended to the
415: .Ql Ev MAKEFLAGS
416: variable which is then
417: entered into the environment for all programs which
418: .Nm make
419: executes.
420: .El
421: .Pp
422: Variable expansion may be modified to select or modify each word of the
423: variable (where a ``word'' is white-space delimited sequence of characters).
424: The general format of a variable expansion is as follows:
425: .Pp
426: .Dl {variable[:modifier[:...]]}
427: .Pp
428: Each modifier begins with a colon and one of the following
429: special characters.
430: The colon may be escaped with a backslash
431: .Pq Ql \e .
432: .Bl -tag -width Cm E\&
433: .It Cm E
434: Replaces each word in the variable with its suffix.
435: .It Cm H
436: Replaces each word in the variable with everything but the last component.
437: .It Cm M Ns Ar pattern
438: Select only those words that match the rest of the modifier.
439: The standard shell wildcard characters
440: .Pf ( Ql * ,
441: .Ql ? ,
442: and
443: .Ql Op )
444: may
445: be used.
446: The wildcard characters may be escaped with a backslash
447: .Pq Ql \e .
448: .It Cm N Ns Ar pattern
449: This is identical to
450: .Ql Cm M ,
451: but selects all words which do not match
452: the rest of the modifier.
453: .It Cm R
454: Replaces each word in the variable with everything but its suffix.
455: .Sm off
456: .It Cm S No \&/ Ar old_pattern Xo
457: .No \&/ Ar new_pattern
458: .No \&/ Op Cm g
459: .Xc
460: .Sm on
461: Modify the first occurrence of
462: .Ar old_pattern
463: in each word to be replaced with
464: .Ar new_pattern .
465: If a
466: .Ql g
467: is appended to the last slash of the pattern, all occurrences
468: in each word are replaced.
469: If
470: .Ar old_pattern
471: begins with a carat
472: .Pq Ql ^ ,
473: .Ar old_pattern
474: is anchored at the beginning of each word.
475: If
476: .Ar old_pattern
477: ends with a dollar sign
478: .Pq Ql \&$ ,
479: it is anchored at the end of each word.
480: Inside
481: .Ar new_string ,
482: an ampersand
483: .Pq Ql &
484: is replaced by
485: .Ar old_pattern .
486: Any character may be used as a delimiter for the parts of the modifier
487: string.
488: The anchoring, ampersand and delimiter characters may be escaped with a
489: backslash
490: .Pq Ql \e .
491: .Pp
492: Variable expansion occurs in the normal fashion inside both
493: .Ar old_string
494: and
495: .Ar new_string
496: with the single exception that a backslash is used to prevent the expansion
497: of a dollar sign
498: .Pq Ql \&$
499: not a preceding dollar sign as is usual.
500: .It Cm T
501: Replaces each word in the variable with its last component.
502: .It Ar old_string=new_string
503: This is the
504: .At V
505: style variable substitution.
506: It must be the last modifier specified.
1.6 cgd 507: If
508: .Ar old_string
509: or
510: .Ar new_string
511: do not contain the pattern matching character
512: .Ar %
513: then it is assumed that they are
514: anchored at the end of each word, so only suffixes or entire
515: words may be replaced. Otherwise
516: .Ar %
517: is the substring of
518: .Ar old_string
519: to be replaced in
520: .Ar new_string
521: .El
522: .Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS
523: Makefile inclusion, conditional structures and for loops reminiscent
524: of the C programming language are provided in
1.1 cgd 525: .Nm make .
526: All such structures are identified by a line beginning with a single
527: dot
528: .Pq Ql \&.
529: character.
530: Files are included with either
531: .Ql .include <file>
532: or
533: .Ql .include \*qfile\*q .
534: Variables between the angle brackets or double quotes are expanded
535: to form the file name.
536: If angle brackets are used, the included makefile is expected to be in
537: the system makefile directory.
538: If double quotes are used, the including makefile's directory and any
539: directories specified using the
540: .Fl I
541: option are searched before the system
542: makefile directory.
543: .Pp
544: Conditional expressions are also preceded by a single dot as the first
1.5 jtc 545: character of a line.
1.1 cgd 546: The possible conditionals are as follows:
547: .Bl -tag -width Ds
548: .It Ic .undef Ar variable
549: Un-define the specified global variable.
550: Only global variables may be un-defined.
551: .It Xo
552: .Ic \&.if
553: .Oo \&! Oc Ns Ar expression
554: .Op Ar operator expression ...
555: .Xc
556: Test the value of an expression.
557: .It Xo
558: .Ic .ifdef
559: .Oo \&! Oc Ns Ar variable
560: .Op Ar operator variable ...
561: .Xc
1.7 mycroft 562: Test the value of a variable.
1.1 cgd 563: .It Xo
564: .Ic .ifndef
565: .Oo \&! Oc Ns Ar variable
566: .Op Ar operator variable ...
567: .Xc
1.7 mycroft 568: Test the value of a variable.
1.1 cgd 569: .It Xo
570: .Ic .ifmake
571: .Oo \&! Oc Ns Ar target
572: .Op Ar operator target ...
573: .Xc
1.7 mycroft 574: Test the target being built.
1.1 cgd 575: .It Xo
576: .Ic .ifnmake
577: .Oo \&! Oc Ar target
578: .Op Ar operator target ...
579: .Xc
580: Test the target being built.
581: .It Ic .else
582: Reverse the sense of the last conditional.
583: .It Xo
584: .Ic .elif
585: .Oo \&! Oc Ar expression
586: .Op Ar operator expression ...
587: .Xc
588: A combination of
589: .Ql Ic .else
590: followed by
591: .Ql Ic .if .
592: .It Xo
593: .Ic .elifdef
594: .Oo \&! Oc Ns Ar variable
595: .Op Ar operator variable ...
596: .Xc
597: A combination of
598: .Ql Ic .else
599: followed by
600: .Ql Ic .ifdef .
601: .It Xo
602: .Ic .elifndef
603: .Oo \&! Oc Ns Ar variable
604: .Op Ar operator variable ...
605: .Xc
606: A combination of
607: .Ql Ic .else
608: followed by
609: .Ql Ic .ifndef .
610: .It Xo
611: .Ic .elifmake
612: .Oo \&! Oc Ns Ar target
613: .Op Ar operator target ...
614: .Xc
615: A combination of
616: .Ql Ic .else
617: followed by
618: .Ql Ic .ifmake .
619: .It Xo
620: .Ic .elifnmake
621: .Oo \&! Oc Ns Ar target
622: .Op Ar operator target ...
623: .Xc
624: A combination of
625: .Ql Ic .else
626: followed by
627: .Ql Ic .ifnmake .
628: .It Ic .endif
629: End the body of the conditional.
630: .El
631: .Pp
632: The
633: .Ar operator
634: may be any one of the following:
635: .Bl -tag -width "Cm XX"
636: .It Cm \&|\&|
637: logical OR
638: .It Cm \&&&
639: Logical
640: .Tn AND ;
641: of higher precedence than
642: .Dq .
643: .El
644: .Pp
645: As in C,
646: .Nm make
647: will only evaluate a conditional as far as is necessary to determine
648: its value.
649: Parenthesis may be used to change the order of evaluation.
650: The boolean operator
651: .Ql Ic \&!
652: may be used to logically negate an entire
653: conditional.
1.5 jtc 654: It is of higher precedence than
1.1 cgd 655: .Ql Ic \&&& .
656: .Pp
657: The value of
658: .Ar expression
659: may be any of the following:
660: .Bl -tag -width Ic defined
661: .It Ic defined
662: Takes a variable name as an argument and evaluates to true if the variable
663: has been defined.
664: .It Ic make
665: Takes a target name as an argument and evaluates to true if the target
666: was specified as part of
667: .Nm make Ns 's
668: command line or was declared the default target (either implicitly or
669: explicitly, see
670: .Va .MAIN )
671: before the line containing the conditional.
672: .It Ic empty
1.5 jtc 673: Takes a variable, with possible modifiers, and evaluates to true if
1.1 cgd 674: the expansion of the variable would result in an empty string.
675: .It Ic exists
676: Takes a file name as an argument and evaluates to true if the file exists.
677: The file is searched for on the system search path (see
678: .Va .PATH ) .
679: .It Ic target
680: Takes a target name as an argument and evaluates to true if the target
681: has been defined.
682: .El
683: .Pp
684: .Ar Expression
1.6 cgd 685: may also be an arithmetic or string comparison. Variable expansion is
686: performed on both sides of the comparison, after which the integral
687: values are compared. A value is interpreted as hexadecimal if it is
688: preceded by 0x, otherwise it is decimal; octal numbers are not supported.
689: The standard C relational operators are all supported. If after
690: variable expansion, either the left or right hand side of a
1.1 cgd 691: .Ql Ic ==
692: or
693: .Ql Ic "!="
1.6 cgd 694: operator is not an integral value, then
695: string comparison is performed between the expanded
696: variables.
1.1 cgd 697: If no relational operator is given, it is assumed that the expanded
698: variable is being compared against 0.
699: .Pp
700: When
701: .Nm make
702: is evaluating one of these conditional expression, and it encounters
703: a word it doesn't recognize, either the ``make'' or ``defined''
704: expression is applied to it, depending on the form of the conditional.
705: If the form is
706: .Ql Ic .ifdef
707: or
708: .Ql Ic .ifndef ,
709: the ``defined'' expression
710: is applied.
711: Similarly, if the form is
712: .Ql Ic .ifmake
713: or
714: .Ql Ic .ifnmake , the ``make''
715: expression is applied.
716: .Pp
717: If the conditional evaluates to true the parsing of the makefile continues
718: as before.
719: If it evaluates to false, the following lines are skipped.
720: In both cases this continues until a
721: .Ql Ic .else
722: or
723: .Ql Ic .endif
724: is found.
1.6 cgd 725: .Pp
726: For loops are typically used to apply a set of rules to a list of files.
727: The syntax of a for loop is:
728: .Bl -tag -width Ds
729: .It Xo
730: .Ic \&.for
731: .Ar variable
732: .Ic in
733: .Ar expression
734: .Xc
735: .It Xo
736: <make-rules>
737: .Xc
738: .It Xo
739: .Ic \&.endfor
740: .Xc
741: .El
742: After the for
743: .Ic expression
744: is evaluated, it is split into words. The
745: iteration
746: .Ic variable
747: is successively set to each word, and substituted in the
748: .Ic make-rules
749: inside the body of the for loop.
1.1 cgd 750: .Sh COMMENTS
751: Comments begin with a hash
752: .Pq Ql \&#
753: character, anywhere but in a shell
754: command line, and continue to the end of the line.
755: .Sh SPECIAL SOURCES
756: .Bl -tag -width Ic .IGNORE
757: .It Ic .IGNORE
758: Ignore any errors from the commands associated with this target, exactly
759: as if they all were preceded by a dash
760: .Pq Ql \- .
761: .It Ic .MAKE
762: Execute the commands associated with this target even if the
763: .Fl n
764: or
765: .Fl t
766: options were specified.
767: Normally used to mark recursive
768: .Nm make Ns 's .
769: .It Ic .NOTMAIN
770: Normally
771: .Nm make
772: selects the first target it encounters as the default target to be built
773: if no target was specified.
774: This source prevents this target from being selected.
775: .It Ic .OPTIONAL
776: If a target is marked with this attribute and
777: .Nm make
778: can't figure out how to create it, it will ignore this fact and assume
779: the file isn't needed or already exists.
780: .It Ic .PRECIOUS
781: When
782: .Nm make
783: is interrupted, it removes any partially made targets.
784: This source prevents the target from being removed.
785: .It Ic .SILENT
786: Do not echo any of the commands associated with this target, exactly
787: as if they all were preceded by an at sign
788: .Pq Ql @ .
789: .It Ic .USE
790: Turn the target into
791: .Nm make Ns 's .
792: version of a macro.
793: When the target is used as a source for another target, the other target
794: acquires the commands, sources, and attributes (except for
795: .Ic .USE )
796: of the
797: source.
798: If the target already has commands, the
799: .Ic .USE
800: target's commands are appended
801: to them.
1.12 christos 802: .It Ic .WAIT
803: If special
804: .Ic .WAIT
805: source is appears in a dependency line, the sources that precede it are
806: made before the sources that succeed it in the line. Loops are not being
807: detected and targets that form loops will be silently ignored.
1.1 cgd 808: .El
809: .Sh "SPECIAL TARGETS"
810: Special targets may not be included with other targets, i.e. they must be
811: the only target specified.
812: .Bl -tag -width Ic .BEGIN
813: .It Ic .BEGIN
814: Any command lines attached to this target are executed before anything
815: else is done.
816: .It Ic .DEFAULT
817: This is sort of a
818: .Ic .USE
819: rule for any target (that was used only as a
820: source) that
821: .Nm make
822: can't figure out any other way to create.
823: Only the shell script is used.
824: The
825: .Ic .IMPSRC
826: variable of a target that inherits
827: .Ic .DEFAULT Ns 's
828: commands is set
829: to the target's own name.
830: .It Ic .END
831: Any command lines attached to this target are executed after everything
832: else is done.
833: .It Ic .IGNORE
834: Mark each of the sources with the
835: .Ic .IGNORE
836: attribute.
837: If no sources are specified, this is the equivalent of specifying the
838: .Fl i
839: option.
840: .It Ic .INTERRUPT
841: If
842: .Nm make
843: is interrupted, the commands for this target will be executed.
844: .It Ic .MAIN
845: If no target is specified when
846: .Nm make
847: is invoked, this target will be built.
848: .It Ic .MAKEFLAGS
849: This target provides a way to specify flags for
850: .Nm make
851: when the makefile is used.
852: The flags are as if typed to the shell, though the
853: .Fl f
854: option will have
855: no effect.
1.12 christos 856: .\" XXX: NOT YET!!!!
857: .\" .It Ic .NOTPARALLEL
858: .\" The named targets are executed in non parallel mode. If no targets are
859: .\" specified, then all targets are executed in non parallel mode.
860: .It Ic .NOTPARALLEL
861: Disable parallel mode.
862: .It Ic .NO_PARALLEL
863: Same as above, for compatibility with other pmake variants.
864: .It Ic .ORDER
865: The named targets are made in sequence.
866: .\" XXX: NOT YET!!!!
867: .\" .It Ic .PARALLEL
868: .\" The named targets are executed in parallel mode. If no targets are
869: .\" specified, then all targets are executed in parallel mode.
1.1 cgd 870: .It Ic .PATH
871: The sources are directories which are to be searched for files not
872: found in the current directory.
873: If no sources are specified, any previously specified directories are
874: deleted.
1.14 christos 875: .It Ic .PHONY
876: Apply the
877: .Ic .PHONY
878: attribute to any specified sources. Targets with this attribute are always
879: considered to be out of date.
1.1 cgd 880: .It Ic .PRECIOUS
881: Apply the
882: .Ic .PRECIOUS
883: attribute to any specified sources.
884: If no sources are specified, the
885: .Ic .PRECIOUS
886: attribute is applied to every
887: target in the file.
888: .It Ic .SILENT
889: Apply the
890: .Ic .SILENT
891: attribute to any specified sources.
892: If no sources are specified, the
893: .Ic .SILENT
894: attribute is applied to every
895: command in the file.
896: .It Ic .SUFFIXES
897: Each source specifies a suffix to
898: .Nm make .
1.4 pk 899: If no sources are specified, any previous specified suffices are deleted.
1.1 cgd 900: .Sh ENVIRONMENT
901: .Nm Make
902: utilizes the following environment variables, if they exist:
903: .Ev MAKE ,
904: .Ev MAKEFLAGS
905: and
906: .Ev MAKEOBJDIR .
907: .Sh FILES
908: .Bl -tag -width /usr/share/mk -compact
909: .It .depend
910: list of dependencies
911: .It Makefile
912: list of dependencies
913: .It makefile
914: list of dependencies
915: .It sys.mk
916: system makefile
917: .It /usr/share/mk
918: system makefile directory
919: .El
920: .Sh SEE ALSO
921: .Xr mkdep 1
922: .Sh HISTORY
923: A
924: .Nm Make
925: command appeared in
926: .At v7 .
CVSweb <webmaster@jp.NetBSD.org>