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