1MAKE(1) User Commands MAKE(1)
2
3
4
6 make - GNU make utility to maintain groups of programs
7
9 make [OPTION]... [TARGET]...
10
12 The make utility will determine automatically which pieces of a large
13 program need to be recompiled, and issue the commands to recompile
14 them. The manual describes the GNU implementation of make, which was
15 written by Richard Stallman and Roland McGrath, and is currently main‐
16 tained by Paul Smith. Our examples show C programs, since they are
17 very common, but you can use make with any programming language whose
18 compiler can be run with a shell command. In fact, make is not limited
19 to programs. You can use it to describe any task where some files must
20 be updated automatically from others whenever the others change.
21
22 To prepare to use make, you must write a file called the makefile that
23 describes the relationships among files in your program, and the states
24 the commands for updating each file. In a program, typically the exe‐
25 cutable file is updated from object files, which are in turn made by
26 compiling source files.
27
28 Once a suitable makefile exists, each time you change some source
29 files, this simple shell command:
30
31 make
32
33 suffices to perform all necessary recompilations. The make program
34 uses the makefile description and the last-modification times of the
35 files to decide which of the files need to be updated. For each of
36 those files, it issues the commands recorded in the makefile.
37
38 make executes commands in the makefile to update one or more target
39 names, where name is typically a program. If no -f option is present,
40 make will look for the makefiles GNUmakefile, makefile, and Makefile,
41 in that order.
42
43 Normally you should call your makefile either makefile or Makefile.
44 (We recommend Makefile because it appears prominently near the begin‐
45 ning of a directory listing, right near other important files such as
46 README.) The first name checked, GNUmakefile, is not recommended for
47 most makefiles. You should use this name if you have a makefile that
48 is specific to GNU make, and will not be understood by other versions
49 of make. If makefile is '-', the standard input is read.
50
51 make updates a target if it depends on prerequisite files that have
52 been modified since the target was last modified, or if the target does
53 not exist.
54
56 -b, -m
57 These options are ignored for compatibility with other versions of
58 make.
59
60 -B, --always-make
61 Unconditionally make all targets.
62
63 -C dir, --directory=dir
64 Change to directory dir before reading the makefiles or doing any‐
65 thing else. If multiple -C options are specified, each is inter‐
66 preted relative to the previous one: -C / -C etc is equivalent to
67 -C /etc. This is typically used with recursive invocations of
68 make.
69
70 -d Print debugging information in addition to normal processing. The
71 debugging information says which files are being considered for
72 remaking, which file-times are being compared and with what
73 results, which files actually need to be remade, which implicit
74 rules are considered and which are applied---everything interest‐
75 ing about how make decides what to do.
76
77 --debug[=FLAGS]
78 Print debugging information in addition to normal processing. If
79 the FLAGS are omitted, then the behavior is the same as if -d was
80 specified. FLAGS may be a for all debugging output (same as using
81 -d), b for basic debugging, v for more verbose basic debugging, i
82 for showing implicit rules, j for details on invocation of com‐
83 mands, and m for debugging while remaking makefiles. Use n to
84 disable all previous debugging flags.
85
86 -e, --environment-overrides
87 Give variables taken from the environment precedence over vari‐
88 ables from makefiles.
89
90 -f file, --file=file, --makefile=FILE
91 Use file as a makefile.
92
93 -i, --ignore-errors
94 Ignore all errors in commands executed to remake files.
95
96 -I dir, --include-dir=dir
97 Specifies a directory dir to search for included makefiles. If
98 several -I options are used to specify several directories, the
99 directories are searched in the order specified. Unlike the argu‐
100 ments to other flags of make, directories given with -I flags may
101 come directly after the flag: -Idir is allowed, as well as -I dir.
102 This syntax is allowed for compatibility with the C preprocessor's
103 -I flag.
104
105 -j [jobs], --jobs[=jobs]
106 Specifies the number of jobs (commands) to run simultaneously. If
107 there is more than one -j option, the last one is effective. If
108 the -j option is given without an argument, make will not limit
109 the number of jobs that can run simultaneously.
110
111 -k, --keep-going
112 Continue as much as possible after an error. While the target
113 that failed, and those that depend on it, cannot be remade, the
114 other dependencies of these targets can be processed all the same.
115
116 -l [load], --load-average[=load]
117 Specifies that no new jobs (commands) should be started if there
118 are others jobs running and the load average is at least load (a
119 floating-point number). With no argument, removes a previous load
120 limit.
121
122 -L, --check-symlink-times
123 Use the latest mtime between symlinks and target.
124
125 -n, --just-print, --dry-run, --recon
126 Print the commands that would be executed, but do not execute them
127 (except in certain circumstances).
128
129 -o file, --old-file=file, --assume-old=file
130 Do not remake the file file even if it is older than its dependen‐
131 cies, and do not remake anything on account of changes in file.
132 Essentially the file is treated as very old and its rules are
133 ignored.
134
135 -O[type], --output-sync[=type]
136 When running multiple jobs in parallel with -j, ensure the output
137 of each job is collected together rather than interspersed with
138 output from other jobs. If type is not specified or is target the
139 output from the entire recipe for each target is grouped together.
140 If type is line the output from each command line within a recipe
141 is grouped together. If type is recurse output from an entire
142 recursive make is grouped together. If type is none output syn‐
143 chronization is disabled.
144
145 -p, --print-data-base
146 Print the data base (rules and variable values) that results from
147 reading the makefiles; then execute as usual or as otherwise spec‐
148 ified. This also prints the version information given by the -v
149 switch (see below). To print the data base without trying to
150 remake any files, use make -p -f/dev/null.
151
152 -q, --question
153 ``Question mode''. Do not run any commands, or print anything;
154 just return an exit status that is zero if the specified targets
155 are already up to date, nonzero otherwise.
156
157 -r, --no-builtin-rules
158 Eliminate use of the built-in implicit rules. Also clear out the
159 default list of suffixes for suffix rules.
160
161 -R, --no-builtin-variables
162 Don't define any built-in variables.
163
164 -s, --silent, --quiet
165 Silent operation; do not print the commands as they are executed.
166
167 -S, --no-keep-going, --stop
168 Cancel the effect of the -k option. This is never necessary
169 except in a recursive make where -k might be inherited from the
170 top-level make via MAKEFLAGS or if you set -k in MAKEFLAGS in your
171 environment.
172
173 -t, --touch
174 Touch files (mark them up to date without really changing them)
175 instead of running their commands. This is used to pretend that
176 the commands were done, in order to fool future invocations of
177 make.
178
179 --trace
180 Information about the disposition of each target is printed (why
181 the target is being rebuilt and what commands are run to rebuild
182 it).
183
184 -v, --version
185 Print the version of the make program plus a copyright, a list of
186 authors and a notice that there is no warranty.
187
188 -w, --print-directory
189 Print a message containing the working directory before and after
190 other processing. This may be useful for tracking down errors
191 from complicated nests of recursive make commands.
192
193 --no-print-directory
194 Turn off -w, even if it was turned on implicitly.
195
196 -W file, --what-if=file, --new-file=file, --assume-new=file
197 Pretend that the target file has just been modified. When used
198 with the -n flag, this shows you what would happen if you were to
199 modify that file. Without -n, it is almost the same as running a
200 touch command on the given file before running make, except that
201 the modification time is changed only in the imagination of make.
202
203 --warn-undefined-variables
204 Warn when an undefined variable is referenced.
205
207 GNU make exits with a status of zero if all makefiles were successfully
208 parsed and no targets that were built failed. A status of one will be
209 returned if the -q flag was used and make determines that a target
210 needs to be rebuilt. A status of two will be returned if any errors
211 were encountered.
212
214 The full documentation for make is maintained as a Texinfo manual. If
215 the info and make programs are properly installed at your site, the
216 command
217
218 info make
219
220 should give you access to the complete manual.
221
223 See the chapter ``Problems and Bugs'' in The GNU Make Manual.
224
226 This manual page contributed by Dennis Morse of Stanford University.
227 Further updates contributed by Mike Frysinger. It has been reworked by
228 Roland McGrath. Maintained by Paul Smith.
229
231 Copyright © 1992-1993, 1996-2016 Free Software Foundation, Inc. This
232 file is part of GNU make.
233
234 GNU Make is free software; you can redistribute it and/or modify it
235 under the terms of the GNU General Public License as published by the
236 Free Software Foundation; either version 3 of the License, or (at your
237 option) any later version.
238
239 GNU Make is distributed in the hope that it will be useful, but WITHOUT
240 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
241 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
242 for more details.
243
244 You should have received a copy of the GNU General Public License along
245 with this program. If not, see http://www.gnu.org/licenses/.
246
247
248
249GNU 28 February 2016 MAKE(1)