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