1 | .TH MAKE 1L "22 August 1989" "GNU" "LOCAL USER COMMANDS" |
---|
2 | .SH NAME |
---|
3 | make \- GNU make utility to maintain groups of programs |
---|
4 | .SH SYNOPSIS |
---|
5 | .B "make " |
---|
6 | [ |
---|
7 | .B \-f |
---|
8 | .I makefile |
---|
9 | ] [ option ] ... |
---|
10 | target ... |
---|
11 | .SH WARNING |
---|
12 | This man page is an extract of the documentation of |
---|
13 | .I GNU make . |
---|
14 | It is updated only occasionally, because the GNU project does not use nroff. |
---|
15 | For complete, current documentation, refer to the Info file |
---|
16 | .B make.info |
---|
17 | which is made from the Texinfo source file |
---|
18 | .BR make.texinfo . |
---|
19 | .SH DESCRIPTION |
---|
20 | .LP |
---|
21 | The purpose of the |
---|
22 | .I make |
---|
23 | utility is to determine automatically which |
---|
24 | pieces of a large program need to be recompiled, and issue the commands to |
---|
25 | recompile them. |
---|
26 | The manual describes the GNU implementation of |
---|
27 | .IR make , |
---|
28 | which was written by Richard Stallman and Roland McGrath. |
---|
29 | Our examples show C programs, since they are most common, but you can use |
---|
30 | .I make |
---|
31 | with any programming language whose compiler can be run with a |
---|
32 | shell command. |
---|
33 | In fact, |
---|
34 | .I make |
---|
35 | is not limited to programs. |
---|
36 | You can use it to describe any task where some files must be |
---|
37 | updated automatically from others whenever the others change. |
---|
38 | .LP |
---|
39 | To prepare to use |
---|
40 | .IR make , |
---|
41 | you must write a file called the |
---|
42 | .I makefile |
---|
43 | that describes the relationships among files in your program, and the |
---|
44 | states the commands for updating each file. |
---|
45 | In a program, typically the executable file is updated from object |
---|
46 | files, which are in turn made by compiling source files. |
---|
47 | .LP |
---|
48 | Once a suitable makefile exists, each time you change some source files, |
---|
49 | this simple shell command: |
---|
50 | .sp 1 |
---|
51 | .RS |
---|
52 | .B make |
---|
53 | .RE |
---|
54 | .sp 1 |
---|
55 | suffices to perform all necessary recompilations. |
---|
56 | The |
---|
57 | .I make |
---|
58 | program uses the makefile data base and the last-modification times |
---|
59 | of the files to decide which of the files need to be updated. |
---|
60 | For each of those files, it issues the commands recorded in the data base. |
---|
61 | .LP |
---|
62 | .I make |
---|
63 | executes commands in the |
---|
64 | .I makefile |
---|
65 | to update |
---|
66 | one or more target |
---|
67 | .IR names , |
---|
68 | where |
---|
69 | .I name |
---|
70 | is typically a program. |
---|
71 | If no |
---|
72 | .B \-f |
---|
73 | option is present, |
---|
74 | .I make |
---|
75 | will look for the makefiles |
---|
76 | .IR GNUmakefile , |
---|
77 | .IR makefile , |
---|
78 | and |
---|
79 | .IR Makefile , |
---|
80 | in that order. |
---|
81 | .LP |
---|
82 | Normally you should call your makefile either |
---|
83 | .I makefile |
---|
84 | or |
---|
85 | .IR Makefile . |
---|
86 | (We recommend |
---|
87 | .I Makefile |
---|
88 | because it appears prominently near the beginning of a directory |
---|
89 | listing, right near other important files such as |
---|
90 | .IR README .) |
---|
91 | The first name checked, |
---|
92 | .IR GNUmakefile , |
---|
93 | is not recommended for most makefiles. |
---|
94 | You should use this name if you have a makefile that is specific to GNU |
---|
95 | .IR make , |
---|
96 | and will not be understood by other versions of |
---|
97 | .IR make . |
---|
98 | If |
---|
99 | .I makefile |
---|
100 | is `\-', the standard input is read. |
---|
101 | .LP |
---|
102 | .I make |
---|
103 | updates a target if it depends on prerequisite files |
---|
104 | that have been modified since the target was last modified, |
---|
105 | or if the target does not exist. |
---|
106 | .SH OPTIONS |
---|
107 | .sp 1 |
---|
108 | .TP 0.5i |
---|
109 | .B \-b |
---|
110 | .TP 0.5i |
---|
111 | .B \-m |
---|
112 | These options are ignored for compatibility with other versions of |
---|
113 | .IR make . |
---|
114 | .TP 0.5i |
---|
115 | .BI "\-C " dir |
---|
116 | Change to directory |
---|
117 | .I dir |
---|
118 | before reading the makefiles or doing anything else. |
---|
119 | If multiple |
---|
120 | .B \-C |
---|
121 | options are specified, each is interpreted relative to the |
---|
122 | previous one: |
---|
123 | .BR "\-C " / |
---|
124 | .BR "\-C " etc |
---|
125 | is equivalent to |
---|
126 | .BR "\-C " /etc. |
---|
127 | This is typically used with recursive invocations of |
---|
128 | .IR make . |
---|
129 | .TP 0.5i |
---|
130 | .B \-d |
---|
131 | Print debugging information in addition to normal processing. |
---|
132 | The debugging information says which files are being considered for |
---|
133 | remaking, which file-times are being compared and with what results, |
---|
134 | which files actually need to be remade, which implicit rules are |
---|
135 | considered and which are applied---everything interesting about how |
---|
136 | .I make |
---|
137 | decides what to do. |
---|
138 | .TP 0.5i |
---|
139 | .B \-e |
---|
140 | Give variables taken from the environment precedence |
---|
141 | over variables from makefiles. |
---|
142 | .TP 0.5i |
---|
143 | .BI "\-f " file |
---|
144 | Use |
---|
145 | .I file |
---|
146 | as a makefile. |
---|
147 | .TP 0.5i |
---|
148 | .B \-i |
---|
149 | Ignore all errors in commands executed to remake files. |
---|
150 | .TP 0.5i |
---|
151 | .BI "\-I " dir |
---|
152 | Specifies a directory |
---|
153 | .I dir |
---|
154 | to search for included makefiles. |
---|
155 | If several |
---|
156 | .B \-I |
---|
157 | options are used to specify several directories, the directories are |
---|
158 | searched in the order specified. |
---|
159 | Unlike the arguments to other flags of |
---|
160 | .IR make , |
---|
161 | directories given with |
---|
162 | .B \-I |
---|
163 | flags may come directly after the flag: |
---|
164 | .BI \-I dir |
---|
165 | is allowed, as well as |
---|
166 | .BI "\-I " dir. |
---|
167 | This syntax is allowed for compatibility with the C |
---|
168 | preprocessor's |
---|
169 | .B \-I |
---|
170 | flag. |
---|
171 | .TP 0.5i |
---|
172 | .BI "\-j " jobs |
---|
173 | Specifies the number of jobs (commands) to run simultaneously. |
---|
174 | If there is more than one |
---|
175 | .B \-j |
---|
176 | option, the last one is effective. |
---|
177 | If the |
---|
178 | .B \-j |
---|
179 | option is given without an argument, |
---|
180 | .IR make |
---|
181 | will not limit the number of jobs that can run simultaneously. |
---|
182 | .TP 0.5i |
---|
183 | .B \-k |
---|
184 | Continue as much as possible after an error. |
---|
185 | While the target that failed, and those that depend on it, cannot |
---|
186 | be remade, the other dependencies of these targets can be processed |
---|
187 | all the same. |
---|
188 | .TP 0.5i |
---|
189 | .B \-l |
---|
190 | .TP 0.5i |
---|
191 | .BI "\-l " load |
---|
192 | Specifies that no new jobs (commands) should be started if there are |
---|
193 | others jobs running and the load average is at least |
---|
194 | .I load |
---|
195 | (a floating-point number). |
---|
196 | With no argument, removes a previous load limit. |
---|
197 | .TP 0.5i |
---|
198 | .B \-n |
---|
199 | Print the commands that would be executed, but do not execute them. |
---|
200 | .TP 0.5i |
---|
201 | .BI "\-o " file |
---|
202 | Do not remake the file |
---|
203 | .I file |
---|
204 | even if it is older than its dependencies, and do not remake anything |
---|
205 | on account of changes in |
---|
206 | .IR file . |
---|
207 | Essentially the file is treated as very old and its rules are ignored. |
---|
208 | .TP 0.5i |
---|
209 | .B \-p |
---|
210 | Print the data base (rules and variable values) that results from |
---|
211 | reading the makefiles; then execute as usual or as otherwise |
---|
212 | specified. |
---|
213 | This also prints the version information given by the |
---|
214 | .B \-v |
---|
215 | switch (see below). |
---|
216 | To print the data base without trying to remake any files, use |
---|
217 | .B make |
---|
218 | .B \-p |
---|
219 | .BI \-f /dev/null. |
---|
220 | .TP 0.5i |
---|
221 | .B \-q |
---|
222 | ``Question mode''. |
---|
223 | Do not run any commands, or print anything; just return an exit status |
---|
224 | that is zero if the specified targets are already up to date, nonzero |
---|
225 | otherwise. |
---|
226 | .TP 0.5i |
---|
227 | .B \-r |
---|
228 | Eliminate use of the built-in implicit rules. |
---|
229 | Also clear out the default list of suffixes for suffix rules. |
---|
230 | .TP 0.5i |
---|
231 | .B \-s |
---|
232 | Silent operation; do not print the commands as they are executed. |
---|
233 | .TP 0.5i |
---|
234 | .B \-S |
---|
235 | Cancel the effect of the |
---|
236 | .B \-k |
---|
237 | option. |
---|
238 | This is never necessary except in a recursive |
---|
239 | .I make |
---|
240 | where |
---|
241 | .B \-k |
---|
242 | might be inherited from the top-level |
---|
243 | .I make |
---|
244 | via MAKEFLAGS or if you set |
---|
245 | .B \-k |
---|
246 | in MAKEFLAGS in your environment. |
---|
247 | .TP 0.5i |
---|
248 | .B \-t |
---|
249 | Touch files (mark them up to date without really changing them) |
---|
250 | instead of running their commands. |
---|
251 | This is used to pretend that the commands were done, in order to fool |
---|
252 | future invocations of |
---|
253 | .IR make . |
---|
254 | .TP 0.5i |
---|
255 | .B \-v |
---|
256 | Print the version of the |
---|
257 | .I make |
---|
258 | program plus a copyright, a list of authors and a notice that there |
---|
259 | is no warranty. |
---|
260 | .TP 0.5i |
---|
261 | .B \-w |
---|
262 | Print a message containing the working directory |
---|
263 | before and after other processing. |
---|
264 | This may be useful for tracking down errors from complicated nests of |
---|
265 | recursive |
---|
266 | .I make |
---|
267 | commands. |
---|
268 | .TP 0.5i |
---|
269 | .BI "\-W " file |
---|
270 | Pretend that the target |
---|
271 | .I file |
---|
272 | has just been modified. |
---|
273 | When used with the |
---|
274 | .B \-n |
---|
275 | flag, this shows you what would happen if you were to modify that file. |
---|
276 | Without |
---|
277 | .BR \-n , |
---|
278 | it is almost the same as running a |
---|
279 | .I touch |
---|
280 | command on the given file before running |
---|
281 | .IR make , |
---|
282 | except that the modification time is changed only in the imagination of |
---|
283 | .IR make . |
---|
284 | .SH "SEE ALSO" |
---|
285 | .I "The GNU Make Manual" |
---|
286 | .SH BUGS |
---|
287 | See the chapter `Problems and Bugs' in |
---|
288 | .I "The GNU Make Manual" . |
---|
289 | .SH AUTHOR |
---|
290 | This manual page contributed by Dennis Morse of Stanford University. |
---|
291 | It has been reworked by Roland McGrath. |
---|