VirtualBox

source: kBuild/trunk/src/kmk/make.1

Last change on this file was 3140, checked in by bird, 7 years ago

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette