1 .TH MAKE 1 "28 February 2016" "GNU" "User Commands"
3 make \- GNU make utility to maintain groups of programs
6 [\fIOPTION\fR]... [\fITARGET\fR]...
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
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
19 with any programming language whose compiler can be run with a shell command.
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.
27 you must write a file called the
29 that describes the relationships among files in your program, and the states
30 the commands for updating each file. In a program, typically the executable
31 file is updated from object files, which are in turn made by compiling source
34 Once a suitable makefile exists, each time you change some source files,
35 this simple shell command:
41 suffices to perform all necessary recompilations.
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.
49 executes commands in the
51 to update one or more target
55 is typically a program.
60 will look for the makefiles
67 Normally you should call your makefile either
73 because it appears prominently near the beginning of a directory
74 listing, right near other important files such as
76 The first name checked,
78 is not recommended for most makefiles. You should use this name if you have a
79 makefile that is specific to GNU
81 and will not be understood by other versions of
85 is '\-', the standard input is read.
88 updates a target if it depends on prerequisite files
89 that have been modified since the target was last modified,
90 or if the target does not exist.
95 These options are ignored for compatibility with other versions of
98 \fB\-B\fR, \fB\-\-always\-make\fR
99 Unconditionally make all targets.
101 \fB\-C\fR \fIdir\fR, \fB\-\-directory\fR=\fIdir\fR
104 before reading the makefiles or doing anything else.
107 options are specified, each is interpreted relative to the
113 This is typically used with recursive invocations of
117 Print debugging information in addition to normal processing.
118 The debugging information says which files are being considered for
119 remaking, which file-times are being compared and with what results,
120 which files actually need to be remade, which implicit rules are
121 considered and which are applied---everything interesting about how
125 .BI \-\-debug "[=FLAGS]"
126 Print debugging information in addition to normal processing.
129 are omitted, then the behavior is the same as if
135 for all debugging output (same as using
140 for more verbose basic debugging,
142 for showing implicit rules,
144 for details on invocation of commands, and
146 for debugging while remaking makefiles. Use
148 to disable all previous debugging flags.
150 \fB\-e\fR, \fB\-\-environment\-overrides\fR
151 Give variables taken from the environment precedence over variables
154 \fB\-E\fR \fIstring\fR, \fB\-\-eval\fR \fIstring\fR
155 Interpret \fIstring\fR using the \fBeval\fR function, before parsing any
158 \fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR, \fB\-\-makefile\fR=\fIFILE\fR
163 \fB\-i\fR, \fB\-\-ignore\-errors\fR
164 Ignore all errors in commands executed to remake files.
166 \fB\-I\fR \fIdir\fR, \fB\-\-include\-dir\fR=\fIdir\fR
167 Specifies a directory
169 to search for included makefiles.
172 options are used to specify several directories, the directories are
173 searched in the order specified.
174 Unlike the arguments to other flags of
176 directories given with
178 flags may come directly after the flag:
180 is allowed, as well as
183 This syntax is allowed for compatibility with the C
188 \fB\-j\fR [\fIjobs\fR], \fB\-\-jobs\fR[=\fIjobs\fR]
189 Specifies the number of
191 (commands) to run simultaneously.
192 If there is more than one
194 option, the last one is effective.
197 option is given without an argument,
199 will not limit the number of jobs that can run simultaneously.
201 \fB\-k\fR, \fB\-\-keep\-going\fR
202 Continue as much as possible after an error.
203 While the target that failed, and those that depend on it, cannot
204 be remade, the other dependencies of these targets can be processed
207 \fB\-l\fR [\fIload\fR], \fB\-\-load\-average\fR[=\fIload\fR]
208 Specifies that no new jobs (commands) should be started if there are
209 others jobs running and the load average is at least
211 (a floating-point number).
212 With no argument, removes a previous load limit.
214 \fB\-L\fR, \fB\-\-check\-symlink\-times\fR
215 Use the latest mtime between symlinks and target.
217 \fB\-n\fR, \fB\-\-just\-print\fR, \fB\-\-dry\-run\fR, \fB\-\-recon\fR
218 Print the commands that would be executed, but do not execute them (except in
219 certain circumstances).
221 \fB\-o\fR \fIfile\fR, \fB\-\-old\-file\fR=\fIfile\fR, \fB\-\-assume\-old\fR=\fIfile\fR
222 Do not remake the file
224 even if it is older than its dependencies, and do not remake anything
225 on account of changes in
227 Essentially the file is treated as very old and its rules are ignored.
229 \fB\-O\fR[\fItype\fR], \fB\-\-output\-sync\fR[=\fItype\fR]
230 When running multiple jobs in parallel with \fB-j\fR, ensure the output of
231 each job is collected together rather than interspersed with output from
234 is not specified or is
236 the output from the entire recipe for each target is grouped together. If
240 the output from each command line within a recipe is grouped together.
245 output from an entire recursive make is grouped together. If
249 output synchronization is disabled.
251 \fB\-p\fR, \fB\-\-print\-data\-base\fR
252 Print the data base (rules and variable values) that results from
253 reading the makefiles; then execute as usual or as otherwise
255 This also prints the version information given by the
258 To print the data base without trying to remake any files, use
259 .IR "make \-p \-f/dev/null" .
261 \fB\-q\fR, \fB\-\-question\fR
263 Do not run any commands, or print anything; just return an exit status
264 that is zero if the specified targets are already up to date, nonzero
267 \fB\-r\fR, \fB\-\-no\-builtin\-rules\fR
268 Eliminate use of the built\-in implicit rules.
269 Also clear out the default list of suffixes for suffix rules.
271 \fB\-R\fR, \fB\-\-no\-builtin\-variables\fR
272 Don't define any built\-in variables.
274 \fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
275 Silent operation; do not print the commands as they are executed.
278 Cancel the effect of the \fB\-s\fR option.
280 \fB\-S\fR, \fB\-\-no\-keep\-going\fR, \fB\-\-stop\fR
281 Cancel the effect of the
285 \fB\-t\fR, \fB\-\-touch\fR
286 Touch files (mark them up to date without really changing them)
287 instead of running their commands.
288 This is used to pretend that the commands were done, in order to fool
289 future invocations of
293 Information about the disposition of each target is printed (why the target is
294 being rebuilt and what commands are run to rebuild it).
296 \fB\-v\fR, \fB\-\-version\fR
297 Print the version of the
299 program plus a copyright, a list of authors and a notice that there
302 \fB\-w\fR, \fB\-\-print\-directory\fR
303 Print a message containing the working directory
304 before and after other processing.
305 This may be useful for tracking down errors from complicated nests of
310 .B \-\-no\-print\-directory
313 even if it was turned on implicitly.
315 \fB\-W\fR \fIfile\fR, \fB\-\-what\-if\fR=\fIfile\fR, \fB\-\-new\-file\fR=\fIfile\fR, \fB\-\-assume\-new\fR=\fIfile\fR
316 Pretend that the target
318 has just been modified.
321 flag, this shows you what would happen if you were to modify that file.
324 it is almost the same as running a
326 command on the given file before running
328 except that the modification time is changed only in the imagination of
331 .B \-\-warn\-undefined\-variables
332 Warn when an undefined variable is referenced.
336 exits with a status of zero if all makefiles were successfully parsed
337 and no targets that were built failed. A status of one will be returned
342 determines that a target needs to be rebuilt. A status of two will be
343 returned if any errors were encountered.
345 The full documentation for
347 is maintained as a Texinfo manual. If the
351 programs are properly installed at your site, the command
355 should give you access to the complete manual.
357 See the chapter ``Problems and Bugs'' in
358 .IR "The GNU Make Manual" .
360 This manual page contributed by Dennis Morse of Stanford University.
361 Further updates contributed by Mike Frysinger. It has been reworked by Roland
362 McGrath. Maintained by Paul Smith.
364 Copyright \(co 1992-1993, 1996-2020 Free Software Foundation, Inc.
368 GNU Make is free software; you can redistribute it and/or modify it under the
369 terms of the GNU General Public License as published by the Free Software
370 Foundation; either version 3 of the License, or (at your option) any later
373 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
374 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
375 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
377 You should have received a copy of the GNU General Public License along with
378 this program. If not, see
379 .IR http://www.gnu.org/licenses/ .