|
|
1.1 root 1: .TH MAKE 1 "18 January 1983"
2: .UC 4
3: .SH NAME
4: make \- maintain program groups
5: .SH SYNOPSIS
6: .B make
7: [
8: .B \-f
9: makefile ] [ option ] ...
10: file ...
11: .SH DESCRIPTION
12: .I Make
13: executes commands in
14: .I makefile
15: to update
16: one or more target
17: .IR names .
18: .I Name
19: is typically a program.
20: If no
21: .B \-f
22: option is present, `makefile' and `Makefile' are
23: tried in order.
24: If
25: .I makefile
26: is `\-', the standard input is taken.
27: More than one
28: .B \-f
29: option may appear
30: .PP
31: .I Make
32: updates a target if it depends on prerequisite files
33: that have been modified since the target was last modified,
34: or if the target does not exist.
35: .PP
36: .I Makefile
37: contains a sequence of entries that specify dependencies.
38: The first line of an entry is a
39: blank-separated list of targets, then a colon,
40: then a list of prerequisite files.
41: Text following a semicolon, and all following lines
42: that begin with a tab, are shell commands
43: to be executed to update the target.
44: If a name appears on the left of more than one `colon' line, then it depends
45: on all of the names on the right of the colon on those lines, but only
46: one command sequence may be specified for it.
47: If a name appears on a line with a double colon
48: .B "::"
49: then the command sequence following that line is performed
50: only if the name is out of date with respect to the names to the right
51: of the double colon, and is not affected by other double colon lines
52: on which that name may appear.
53: .PP
54: Two special forms of a name are recognized.
55: A name like
56: .IR a ( b )
57: means the file named
58: .I b
59: stored in the archive named
60: .I a.
61: A name like
62: .IR a (( b ))
63: means the file stored in archive
64: .I a
65: containing the entry point
66: .I b.
67: .PP
68: Sharp and newline surround comments.
69: .PP
70: The following makefile says that `pgm' depends on two
71: files `a.o' and `b.o', and that they in turn depend on
72: `.c' files and a common file `incl'.
73: .RS
74: .HP
75: .PD 0
76: .nf
77: pgm: a.o b.o
78: cc a.o b.o \-lm \-o pgm
79: .HP
80: a.o: incl a.c
81: cc \-c a.c
82: .HP
83: b.o: incl b.c
84: cc \-c b.c
85: .fi
86: .RE
87: .PD
88: .PP
89: .I Makefile
90: entries of the form
91: .PP
92: .IP
93: string1 = string2
94: .PP
95: are macro definitions.
96: Subsequent appearances of
97: .RI $( string1 )
98: or
99: .RI ${ string1 }
100: are replaced by
101: .IR string2 .
102: If
103: .I string1
104: is a single character, the parentheses or braces
105: are optional.
106: .PP
107: .I Make
108: infers prerequisites for files for which
109: .I makefile
110: gives no construction commands.
111: For example, a
112: `.c' file may be inferred as prerequisite for a `.o' file
113: and be compiled to produce the `.o' file.
114: Thus the preceding example can be done more briefly:
115: .RS
116: .HP
117: .PD 0
118: .nf
119: pgm: a.o b.o
120: cc a.o b.o \-lm \-o pgm
121: .HP
122: a.o b.o: incl
123: .fi
124: .RE
125: .PD
126: .PP
127: Prerequisites are inferred according to selected suffixes
128: listed as the `prerequisites' for the special name `.SUFFIXES';
129: multiple lists accumulate;
130: an empty list clears what came before.
131: Order is significant; the first possible name for which both
132: a file and a rule as described in the next paragraph exist
133: is inferred.
134: The default list is
135: .IP
136: \&.SUFFIXES: .out .o .c .e .r .f .y .l .s .p
137: .PP
138: The rule to create a file with suffix
139: .I s2
140: that depends on a similarly named file with suffix
141: .I s1
142: is specified as an entry
143: for the `target'
144: .IR s1s2 .
145: In such an entry, the special macro $* stands for
146: the target name with suffix deleted, $@ for the full target name,
147: $< for the complete list of prerequisites,
148: and
149: $? for the list of prerequisites that are out of date.
150: For example, a rule for making
151: optimized `.o' files from `.c' files is
152: .IP
153: \&.c.o: ; cc \-c \-O \-o $@ $*.c
154: .PP
155: Certain macros are used by the default inference rules
156: to communicate optional arguments to
157: any resulting compilations.
158: In particular,
159: `CFLAGS' is used for
160: .IR cc (1)
161: options,
162: `FFLAGS' for
163: .IR f77 (1)
164: options,
165: `PFLAGS' for
166: .IR pc (1)
167: options,
168: and `LFLAGS' and `YFLAGS' for
169: .I lex
170: and
171: .IR yacc (1)
172: options. In addition, the macro `MFLAGS' is filled in
173: with the initial command line options supplied to
174: .IR make .
175: This simplifies maintaining a hierarchy of makefiles as
176: one may then invoke
177: .I make
178: on makefiles in subdirectories and pass along useful options
179: such as
180: .BR \-k .
181: .PP
182: Command lines are executed one at a time, each by its
183: own shell.
184: A line is printed when it is executed unless
185: the special target `.SILENT'
186: is in
187: .I makefile,
188: or the first character of the command is `@'.
189: .PP
190: Commands returning nonzero status (see
191: .IR intro (1))
192: cause
193: .I make
194: to terminate unless
195: the special target `.IGNORE' is in
196: .I makefile
197: or the command begins with
198: <tab><hyphen>.
199: .PP
200: Interrupt and quit cause the target to be deleted
201: unless the target is a directory or
202: depends on the special name `.PRECIOUS'.
203: .PP
204: Other options:
205: .TP
206: .B \-i
207: Equivalent to the special entry `.IGNORE:'.
208: .TP
209: .B \-k
210: When a command returns nonzero status,
211: abandon work on the current entry, but
212: continue on branches that do not depend on the current entry.
213: .TP
214: .B \-n
215: Trace and print, but do not execute the commands
216: needed to update the targets.
217: .TP
218: .B \-t
219: Touch, i.e. update the modified date of targets, without
220: executing any commands.
221: .TP
222: .B \-r
223: Equivalent to an initial special entry `.SUFFIXES:'
224: with no list.
225: .TP
226: .B \-s
227: Equivalent to the special entry
228: `.SILENT:'.
229: .SH FILES
230: makefile, Makefile
231: .br
232: .SH "SEE ALSO"
233: sh(1), touch(1), f77(1), pc(1)
234: .br
235: S. I. Feldman
236: .I
237: Make \- A Program for Maintaining Computer Programs
238: .SH BUGS
239: Some commands return nonzero status inappropriately.
240: Use
241: .B \-i
242: to overcome the difficulty.
243: .br
244: Commands that are directly executed by the shell,
245: notably
246: .IR cd (1),
247: are ineffectual across newlines in
248: .I make.
249:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.