Debian Codegraph @

upstream/debian-unstable/man1/make.1

raw
1 .TH MAKE 1 "26 May 2023" "GNU" "User Commands"
2 .SH NAME
3 make \- GNU Make utility to maintain groups of programs
4 .SH SYNOPSIS
5 .B make
6 [\fIOPTION\fR]... [\fITARGET\fR]...
7 .SH DESCRIPTION
8 .LP
9 The
10 .I make
11 utility will determine automatically which pieces of a large program need to
12 be recompiled, and issue the commands to recompile them. The manual describes
13 the GNU implementation of
14 .BR make ,
15 which was written by Richard Stallman and Roland McGrath, and is currently
16 maintained by Paul Smith. Our examples show C programs, since they are very
17 common, but you can use
18 .B make
19 with any programming language whose compiler can be run with a shell command.
20 In fact,
21 .B make
22 is not limited to programs. You can use it to describe any task where some
23 files must be updated automatically from others whenever the others change.
24 .LP
25 To prepare to use
26 .BR make ,
27 you must write a file called the
28 .I makefile
29 that describes the relationships among files in your program, and provides
30 commands for updating each file. In a program, typically the executable file
31 is updated from object files, which are in turn made by compiling source
32 files.
33 .LP
34 Once a suitable makefile exists, each time you change some source files,
35 this simple shell command:
36 .sp 1
37 .RS
38 .B make
39 .RE
40 .sp 1
41 suffices to perform all necessary recompilations.
42 The
43 .B make
44 program uses the makefile description and the last-modification times of the
45 files to decide which of the files need to be updated. For each of those
46 files, it issues the commands recorded in the makefile.
47 .LP
48 .B make
49 executes commands in the
50 .I makefile
51 to update one or more
52 .IR targets ,
53 where
54 .I target
55 is typically a program.
56 If no
57 .B \-f
58 option is present,
59 .B make
60 will look for the makefiles
61 .IR GNUmakefile ,
62 .IR makefile ,
63 and
64 .IR Makefile ,
65 in that order.
66 .LP
67 Normally you should call your makefile either
68 .I makefile
69 or
70 .IR Makefile .
71 (We recommend
72 .I Makefile
73 because it appears prominently near the beginning of a directory
74 listing, right near other important files such as
75 .IR README .)
76 The first name checked,
77 .IR GNUmakefile ,
78 is not recommended for most makefiles. You should use this name if you have a
79 makefile that is specific to GNU Make, and will not be understood by other
80 versions of
81 .BR make .
82 If
83 .I makefile
84 is '\-', the standard input is read.
85 .LP
86 .B make
87 updates a target if it depends on prerequisite files
88 that have been modified since the target was last modified,
89 or if the target does not exist.
90 .SH OPTIONS
91 .sp 1
92 .TP 0.5i
93 \fB\-b\fR, \fB\-m\fR
94 These options are ignored for compatibility with other versions of
95 .BR make .
96 .TP 0.5i
97 \fB\-B\fR, \fB\-\-always\-make\fR
98 Unconditionally make all targets.
99 .TP 0.5i
100 \fB\-C\fR \fIdir\fR, \fB\-\-directory\fR=\fIdir\fR
101 Change to directory
102 .I dir
103 before reading the makefiles or doing anything else.
104 If multiple
105 .B \-C
106 options are specified, each is interpreted relative to the
107 previous one:
108 .BR "\-C " /
109 .BR "\-C " etc
110 is equivalent to
111 .BR "\-C " /etc.
112 This is typically used with recursive invocations of
113 .BR make .
114 .TP 0.5i
115 .B \-d
116 Print debugging information in addition to normal processing.
117 The debugging information says which files are being considered for
118 remaking, which file-times are being compared and with what results,
119 which files actually need to be remade, which implicit rules are
120 considered and which are applied---everything interesting about how
121 .B make
122 decides what to do.
123 .TP 0.5i
124 .BI \-\-debug "[=FLAGS]"
125 Print debugging information in addition to normal processing.
126 If the
127 .I FLAGS
128 are omitted, then the behavior is the same as if
129 .B \-d
130 was specified.
131 .I FLAGS
132 may be any or all of the following names, comma- or space-separated. Only the
133 first character is significant: the rest may be omitted:
134 .I all
135 for all debugging output (same as using
136 .BR \-d ),
137 .I basic
138 for basic debugging,
139 .I verbose
140 for more verbose basic debugging,
141 .I implicit
142 for showing implicit rule search operations,
143 .I jobs
144 for details on invocation of commands,
145 .I makefile
146 for debugging while remaking makefiles,
147 .I print
148 shows all recipes that are run even if they are silent, and
149 .I why
150 shows the reason
151 .BR make
152 decided to rebuild each target. Use
153 .I none
154 to disable all previous debugging flags.
155 .TP 0.5i
156 \fB\-e\fR, \fB\-\-environment\-overrides\fR
157 Give variables taken from the environment precedence over variables
158 from makefiles.
159 .TP 0.5i
160 \fB\-E\fR \fIstring\fR, \fB\-\-eval\fR \fIstring\fR
161 Interpret \fIstring\fR using the \fBeval\fR function, before parsing any
162 makefiles.
163 .TP 0.5i
164 \fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR, \fB\-\-makefile\fR=\fIFILE\fR
165 Use
166 .I file
167 as a makefile.
168 .TP 0.5i
169 \fB\-i\fR, \fB\-\-ignore\-errors\fR
170 Ignore all errors in commands executed to remake files.
171 .TP 0.5i
172 \fB\-I\fR \fIdir\fR, \fB\-\-include\-dir\fR=\fIdir\fR
173 Specifies a directory
174 .I dir
175 to search for included makefiles.
176 If several
177 .B \-I
178 options are used to specify several directories, the directories are
179 searched in the order specified.
180 Unlike the arguments to other flags of
181 .BR make ,
182 directories given with
183 .B \-I
184 flags may come directly after the flag:
185 .BI \-I dir
186 is allowed, as well as
187 .B \-I
188 .IR dir .
189 This syntax is allowed for compatibility with the C
190 preprocessor's
191 .B \-I
192 flag.
193 .TP 0.5i
194 \fB\-j\fR [\fIjobs\fR], \fB\-\-jobs\fR[=\fIjobs\fR]
195 Specifies the number of
196 .I jobs
197 (commands) to run simultaneously.
198 If there is more than one
199 .B \-j
200 option, the last one is effective.
201 If the
202 .B \-j
203 option is given without an argument,
204 .BR make
205 will not limit the number of jobs that can run simultaneously.
206 .TP 0.5i
207 \fB\--jobserver-style=\fR\fIstyle\fR
208 The style of jobserver to use. The
209 .I style
210 may be one of
211 .BR fifo ,
212 .BR pipe ,
213 or
214 .B sem
215 (Windows only).
216 .TP 0.5i
217 \fB\-k\fR, \fB\-\-keep\-going\fR
218 Continue as much as possible after an error.
219 While the target that failed, and those that depend on it, cannot
220 be remade, the other dependencies of these targets can be processed
221 all the same.
222 .TP 0.5i
223 \fB\-l\fR [\fIload\fR], \fB\-\-load\-average\fR[=\fIload\fR]
224 Specifies that no new jobs (commands) should be started if there are
225 others jobs running and the load average is at least
226 .I load
227 (a floating-point number).
228 With no argument, removes a previous load limit.
229 .TP 0.5i
230 \fB\-L\fR, \fB\-\-check\-symlink\-times\fR
231 Use the latest mtime between symlinks and target.
232 .TP 0.5i
233 \fB\-n\fR, \fB\-\-just\-print\fR, \fB\-\-dry\-run\fR, \fB\-\-recon\fR
234 Print the commands that would be executed, but do not execute them (except in
235 certain circumstances).
236 .TP 0.5i
237 \fB\-o\fR \fIfile\fR, \fB\-\-old\-file\fR=\fIfile\fR, \fB\-\-assume\-old\fR=\fIfile\fR
238 Do not remake the file
239 .I file
240 even if it is older than its dependencies, and do not remake anything
241 on account of changes in
242 .IR file .
243 Essentially the file is treated as very old and its rules are ignored.
244 .TP 0.5i
245 \fB\-O\fR[\fItype\fR], \fB\-\-output\-sync\fR[=\fItype\fR]
246 When running multiple jobs in parallel with \fB-j\fR, ensure the output of
247 each job is collected together rather than interspersed with output from
248 other jobs. If
249 .I type
250 is not specified or is
251 .B target
252 the output from the entire recipe for each target is grouped together. If
253 .I type
254 is
255 .B line
256 the output from each command line within a recipe is grouped together.
257 If
258 .I type
259 is
260 .B recurse
261 output from an entire recursive make is grouped together. If
262 .I type
263 is
264 .B none
265 output synchronization is disabled.
266 .TP 0.5i
267 \fB\-p\fR, \fB\-\-print\-data\-base\fR
268 Print the data base (rules and variable values) that results from
269 reading the makefiles; then execute as usual or as otherwise
270 specified.
271 This also prints the version information given by the
272 .B \-v
273 switch (see below).
274 To print the data base without trying to remake any files, use
275 .IR "make \-p \-f/dev/null" .
276 .TP 0.5i
277 \fB\-q\fR, \fB\-\-question\fR
278 ``Question mode''.
279 Do not run any commands, or print anything; just return an exit status
280 that is zero if the specified targets are already up to date, nonzero
281 otherwise.
282 .TP 0.5i
283 \fB\-r\fR, \fB\-\-no\-builtin\-rules\fR
284 Eliminate use of the built\-in implicit rules.
285 Also clear out the default list of suffixes for suffix rules.
286 .TP 0.5i
287 \fB\-R\fR, \fB\-\-no\-builtin\-variables\fR
288 Don't define any built\-in variables.
289 .TP 0.5i
290 \fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
291 Silent operation; do not print the commands as they are executed.
292 .TP 0.5i
293 .B \-\-no\-silent
294 Cancel the effect of the \fB\-s\fR option.
295 .TP 0.5i
296 \fB\-S\fR, \fB\-\-no\-keep\-going\fR, \fB\-\-stop\fR
297 Cancel the effect of the
298 .B \-k
299 option.
300 .TP 0.5i
301 \fB\-t\fR, \fB\-\-touch\fR
302 Touch files (mark them up to date without really changing them)
303 instead of running their commands.
304 This is used to pretend that the commands were done, in order to fool
305 future invocations of
306 .BR make .
307 .TP 0.5i
308 .B \-\-trace
309 Information about the disposition of each target is printed (why the target is
310 being rebuilt and what commands are run to rebuild it).
311 .TP 0.5i
312 \fB\-v\fR, \fB\-\-version\fR
313 Print the version of the
314 .B make
315 program plus a copyright, a list of authors and a notice that there
316 is no warranty.
317 .TP 0.5i
318 \fB\-w\fR, \fB\-\-print\-directory\fR
319 Print a message containing the working directory
320 before and after other processing.
321 This may be useful for tracking down errors from complicated nests of
322 recursive
323 .B make
324 commands.
325 .TP 0.5i
326 .B \-\-no\-print\-directory
327 Turn off
328 .BR \-w ,
329 even if it was turned on implicitly.
330 .TP 0.5i
331 .BI \-\-shuffle "[=MODE]"
332 Enable shuffling of goal and prerequisite ordering.
333 .I MODE
334 is one of
335 .I none
336 to disable shuffle mode,
337 .I random
338 to shuffle prerequisites in random order,
339 .I reverse
340 to consider prerequisites in reverse order, or an integer
341 .I <seed>
342 which enables
343 .I random
344 mode with a specific
345 .I seed
346 value. If
347 .I MODE
348 is omitted the default is
349 .IR random .
350 .TP 0.5i
351 \fB\-W\fR \fIfile\fR, \fB\-\-what\-if\fR=\fIfile\fR, \fB\-\-new\-file\fR=\fIfile\fR, \fB\-\-assume\-new\fR=\fIfile\fR
352 Pretend that the target
353 .I file
354 has just been modified.
355 When used with the
356 .B \-n
357 flag, this shows you what would happen if you were to modify that file.
358 Without
359 .BR \-n ,
360 it is almost the same as running a
361 .I touch
362 command on the given file before running
363 .BR make ,
364 except that the modification time is changed only in the imagination of
365 .BR make .
366 .TP 0.5i
367 .B \-\-warn\-undefined\-variables
368 Warn when an undefined variable is referenced.
369 .SH "EXIT STATUS"
370 GNU Make exits with a status of zero if all makefiles were successfully parsed
371 and no targets that were built failed. A status of one will be returned
372 if the
373 .B \-q
374 flag was used and
375 .B make
376 determines that a target needs to be rebuilt. A status of two will be
377 returned if any errors were encountered.
378 .SH "SEE ALSO"
379 The full documentation for
380 .B make
381 is maintained as a Texinfo manual. If the
382 .B info
383 and
384 .B make
385 programs are properly installed at your site, the command
386 .IP
387 .B info make
388 .PP
389 should give you access to the complete manual.
390 .SH BUGS
391 See the chapter ``Problems and Bugs'' in
392 .IR "The GNU Make Manual" .
393 .SH AUTHOR
394 This manual page contributed by Dennis Morse of Stanford University.
395 Further updates contributed by Mike Frysinger. It has been reworked by Roland
396 McGrath. Maintained by Paul Smith.
397 .SH "COPYRIGHT"
398 Copyright \(co 1992-1993, 1996-2023 Free Software Foundation, Inc.
399 This file is part of
400 .IR "GNU Make" .
401 .LP
402 GNU Make is free software; you can redistribute it and/or modify it under the
403 terms of the GNU General Public License as published by the Free Software
404 Foundation; either version 3 of the License, or (at your option) any later
405 version.
406 .LP
407 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
408 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
409 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
410 .LP
411 You should have received a copy of the GNU General Public License along with
412 this program. If not, see
413 .IR https://www.gnu.org/licenses/ .