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