Blame make.1

Packit 26a39e
.TH MAKE 1 "28 February 2016" "GNU" "User Commands"
Packit 26a39e
.SH NAME
Packit 26a39e
make \- GNU make utility to maintain groups of programs
Packit 26a39e
.SH SYNOPSIS
Packit 26a39e
.B make
Packit 26a39e
[\fIOPTION\fR]... [\fITARGET\fR]...
Packit 26a39e
.SH DESCRIPTION
Packit 26a39e
.LP
Packit 26a39e
The
Packit 26a39e
.I make
Packit 26a39e
utility will determine automatically which pieces of a large program need to
Packit 26a39e
be recompiled, and issue the commands to recompile them.  The manual describes
Packit 26a39e
the GNU implementation of
Packit 26a39e
.BR make ,
Packit 26a39e
which was written by Richard Stallman and Roland McGrath, and is currently
Packit 26a39e
maintained by Paul Smith.  Our examples show C programs, since they are very
Packit 26a39e
common, but you can use
Packit 26a39e
.B make
Packit 26a39e
with any programming language whose compiler can be run with a shell command.
Packit 26a39e
In fact,
Packit 26a39e
.B make
Packit 26a39e
is not limited to programs.  You can use it to describe any task where some
Packit 26a39e
files must be updated automatically from others whenever the others change.
Packit 26a39e
.LP
Packit 26a39e
To prepare to use
Packit 26a39e
.BR make ,
Packit 26a39e
you must write a file called the
Packit 26a39e
.I makefile
Packit 26a39e
that describes the relationships among files in your program, and the states
Packit 26a39e
the commands for updating each file.  In a program, typically the executable
Packit 26a39e
file is updated from object files, which are in turn made by compiling source
Packit 26a39e
files.
Packit 26a39e
.LP
Packit 26a39e
Once a suitable makefile exists, each time you change some source files,
Packit 26a39e
this simple shell command:
Packit 26a39e
.sp 1
Packit 26a39e
.RS
Packit 26a39e
.B make
Packit 26a39e
.RE
Packit 26a39e
.sp 1
Packit 26a39e
suffices to perform all necessary recompilations.
Packit 26a39e
The
Packit 26a39e
.B make
Packit 26a39e
program uses the makefile description and the last-modification times of the
Packit 26a39e
files to decide which of the files need to be updated.  For each of those
Packit 26a39e
files, it issues the commands recorded in the makefile.
Packit 26a39e
.LP
Packit 26a39e
.B make
Packit 26a39e
executes commands in the
Packit 26a39e
.I makefile
Packit 26a39e
to update one or more target
Packit 26a39e
.IR names ,
Packit 26a39e
where
Packit 26a39e
.I name
Packit 26a39e
is typically a program.
Packit 26a39e
If no
Packit 26a39e
.B \-f
Packit 26a39e
option is present,
Packit 26a39e
.B make
Packit 26a39e
will look for the makefiles
Packit 26a39e
.IR GNUmakefile ,
Packit 26a39e
.IR makefile ,
Packit 26a39e
and
Packit 26a39e
.IR Makefile ,
Packit 26a39e
in that order.
Packit 26a39e
.LP
Packit 26a39e
Normally you should call your makefile either
Packit 26a39e
.I makefile
Packit 26a39e
or
Packit 26a39e
.IR Makefile .
Packit 26a39e
(We recommend
Packit 26a39e
.I Makefile
Packit 26a39e
because it appears prominently near the beginning of a directory
Packit 26a39e
listing, right near other important files such as
Packit 26a39e
.IR  README .)
Packit 26a39e
The first name checked,
Packit 26a39e
.IR GNUmakefile ,
Packit 26a39e
is not recommended for most makefiles.  You should use this name if you have a
Packit 26a39e
makefile that is specific to GNU
Packit 26a39e
.BR make ,
Packit 26a39e
and will not be understood by other versions of
Packit 26a39e
.BR make .
Packit 26a39e
If
Packit 26a39e
.I makefile
Packit 26a39e
is '\-', the standard input is read.
Packit 26a39e
.LP
Packit 26a39e
.B make
Packit 26a39e
updates a target if it depends on prerequisite files
Packit 26a39e
that have been modified since the target was last modified,
Packit 26a39e
or if the target does not exist.
Packit 26a39e
.SH OPTIONS
Packit 26a39e
.sp 1
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-b\fR, \fB\-m\fR
Packit 26a39e
These options are ignored for compatibility with other versions of
Packit 26a39e
.BR make .
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-B\fR, \fB\-\-always\-make\fR
Packit 26a39e
Unconditionally make all targets.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-C\fR \fIdir\fR, \fB\-\-directory\fR=\fIdir\fR
Packit 26a39e
Change to directory
Packit 26a39e
.I dir
Packit 26a39e
before reading the makefiles or doing anything else.
Packit 26a39e
If multiple
Packit 26a39e
.B \-C
Packit 26a39e
options are specified, each is interpreted relative to the
Packit 26a39e
previous one:
Packit 26a39e
.BR "\-C " /
Packit 26a39e
.BR "\-C " etc
Packit 26a39e
is equivalent to
Packit 26a39e
.BR "\-C " /etc.
Packit 26a39e
This is typically used with recursive invocations of
Packit 26a39e
.BR make .
Packit 26a39e
.TP 0.5i
Packit 26a39e
.B \-d
Packit 26a39e
Print debugging information in addition to normal processing.
Packit 26a39e
The debugging information says which files are being considered for
Packit 26a39e
remaking, which file-times are being compared and with what results,
Packit 26a39e
which files actually need to be remade, which implicit rules are
Packit 26a39e
considered and which are applied---everything interesting about how
Packit 26a39e
.B make
Packit 26a39e
decides what to do.
Packit 26a39e
.TP 0.5i
Packit 26a39e
.BI \-\-debug "[=FLAGS]"
Packit 26a39e
Print debugging information in addition to normal processing.
Packit 26a39e
If the
Packit 26a39e
.I FLAGS
Packit 26a39e
are omitted, then the behavior is the same as if
Packit 26a39e
.B \-d
Packit 26a39e
was specified.
Packit 26a39e
.I FLAGS
Packit 26a39e
may be
Packit 26a39e
.I a
Packit 26a39e
for all debugging output (same as using
Packit 26a39e
.BR \-d ),
Packit 26a39e
.I b
Packit 26a39e
for basic debugging,
Packit 26a39e
.I v
Packit 26a39e
for more verbose basic debugging,
Packit 26a39e
.I i
Packit 26a39e
for showing implicit rules,
Packit 26a39e
.I j
Packit 26a39e
for details on invocation of commands, and
Packit 26a39e
.I m
Packit 26a39e
for debugging while remaking makefiles.  Use
Packit 26a39e
.I n
Packit 26a39e
to disable all previous debugging flags.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-e\fR, \fB\-\-environment\-overrides\fR
Packit 26a39e
Give variables taken from the environment precedence
Packit 26a39e
over variables from makefiles.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR, \fB\-\-makefile\fR=\fIFILE\fR
Packit 26a39e
Use
Packit 26a39e
.I file
Packit 26a39e
as a makefile.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-i\fR, \fB\-\-ignore\-errors\fR
Packit 26a39e
Ignore all errors in commands executed to remake files.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-I\fR \fIdir\fR, \fB\-\-include\-dir\fR=\fIdir\fR
Packit 26a39e
Specifies a directory
Packit 26a39e
.I dir
Packit 26a39e
to search for included makefiles.
Packit 26a39e
If several
Packit 26a39e
.B \-I
Packit 26a39e
options are used to specify several directories, the directories are
Packit 26a39e
searched in the order specified.
Packit 26a39e
Unlike the arguments to other flags of
Packit 26a39e
.BR make ,
Packit 26a39e
directories given with
Packit 26a39e
.B \-I
Packit 26a39e
flags may come directly after the flag:
Packit 26a39e
.BI \-I dir
Packit 26a39e
is allowed, as well as
Packit 26a39e
.B \-I
Packit 26a39e
.IR dir .
Packit 26a39e
This syntax is allowed for compatibility with the C
Packit 26a39e
preprocessor's
Packit 26a39e
.B \-I
Packit 26a39e
flag.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-j\fR [\fIjobs\fR], \fB\-\-jobs\fR[=\fIjobs\fR]
Packit 26a39e
Specifies the number of
Packit 26a39e
.I jobs
Packit 26a39e
(commands) to run simultaneously.
Packit 26a39e
If there is more than one
Packit 26a39e
.B \-j
Packit 26a39e
option, the last one is effective.
Packit 26a39e
If the
Packit 26a39e
.B \-j
Packit 26a39e
option is given without an argument,
Packit 26a39e
.BR make
Packit 26a39e
will not limit the number of jobs that can run simultaneously.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-k\fR, \fB\-\-keep\-going\fR
Packit 26a39e
Continue as much as possible after an error.
Packit 26a39e
While the target that failed, and those that depend on it, cannot
Packit 26a39e
be remade, the other dependencies of these targets can be processed
Packit 26a39e
all the same.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-l\fR [\fIload\fR], \fB\-\-load\-average\fR[=\fIload\fR]
Packit 26a39e
Specifies that no new jobs (commands) should be started if there are
Packit 26a39e
others jobs running and the load average is at least
Packit 26a39e
.I load
Packit 26a39e
(a floating-point number).
Packit 26a39e
With no argument, removes a previous load limit.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-L\fR, \fB\-\-check\-symlink\-times\fR
Packit 26a39e
Use the latest mtime between symlinks and target.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-n\fR, \fB\-\-just\-print\fR, \fB\-\-dry\-run\fR, \fB\-\-recon\fR
Packit 26a39e
Print the commands that would be executed, but do not execute them (except in
Packit 26a39e
certain circumstances).
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-o\fR \fIfile\fR, \fB\-\-old\-file\fR=\fIfile\fR, \fB\-\-assume\-old\fR=\fIfile\fR
Packit 26a39e
Do not remake the file
Packit 26a39e
.I file
Packit 26a39e
even if it is older than its dependencies, and do not remake anything
Packit 26a39e
on account of changes in
Packit 26a39e
.IR file .
Packit 26a39e
Essentially the file is treated as very old and its rules are ignored.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-O\fR[\fItype\fR], \fB\-\-output\-sync\fR[=\fItype\fR]
Packit 26a39e
When running multiple jobs in parallel with \fB-j\fR, ensure the output of
Packit 26a39e
each job is collected together rather than interspersed with output from
Packit 26a39e
other jobs.  If
Packit 26a39e
.I type
Packit 26a39e
is not specified or is
Packit 26a39e
.B target
Packit 26a39e
the output from the entire recipe for each target is grouped together.  If
Packit 26a39e
.I type
Packit 26a39e
is
Packit 26a39e
.B line
Packit 26a39e
the output from each command line within a recipe is grouped together.
Packit 26a39e
If
Packit 26a39e
.I type
Packit 26a39e
is
Packit 26a39e
.B recurse
Packit 26a39e
output from an entire recursive make is grouped together.  If
Packit 26a39e
.I type
Packit 26a39e
is
Packit 26a39e
.B none
Packit 26a39e
output synchronization is disabled.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-p\fR, \fB\-\-print\-data\-base\fR
Packit 26a39e
Print the data base (rules and variable values) that results from
Packit 26a39e
reading the makefiles; then execute as usual or as otherwise
Packit 26a39e
specified.
Packit 26a39e
This also prints the version information given by the
Packit 26a39e
.B \-v
Packit 26a39e
switch (see below).
Packit 26a39e
To print the data base without trying to remake any files, use
Packit 26a39e
.IR "make \-p \-f/dev/null" .
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-q\fR, \fB\-\-question\fR
Packit 26a39e
``Question mode''.
Packit 26a39e
Do not run any commands, or print anything; just return an exit status
Packit 26a39e
that is zero if the specified targets are already up to date, nonzero
Packit 26a39e
otherwise.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-r\fR, \fB\-\-no\-builtin\-rules\fR
Packit 26a39e
Eliminate use of the built\-in implicit rules.
Packit 26a39e
Also clear out the default list of suffixes for suffix rules.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-R\fR, \fB\-\-no\-builtin\-variables\fR
Packit 26a39e
Don't define any built\-in variables.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
Packit 26a39e
Silent operation; do not print the commands as they are executed.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-S\fR, \fB\-\-no\-keep\-going\fR, \fB\-\-stop\fR
Packit 26a39e
Cancel the effect of the
Packit 26a39e
.B \-k
Packit 26a39e
option.
Packit 26a39e
This is never necessary except in a recursive
Packit 26a39e
.B make
Packit 26a39e
where
Packit 26a39e
.B \-k
Packit 26a39e
might be inherited from the top-level
Packit 26a39e
.B make
Packit 26a39e
via MAKEFLAGS or if you set
Packit 26a39e
.B \-k
Packit 26a39e
in MAKEFLAGS in your environment.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-t\fR, \fB\-\-touch\fR
Packit 26a39e
Touch files (mark them up to date without really changing them)
Packit 26a39e
instead of running their commands.
Packit 26a39e
This is used to pretend that the commands were done, in order to fool
Packit 26a39e
future invocations of
Packit 26a39e
.BR make .
Packit 26a39e
.TP 0.5i
Packit 26a39e
.B \-\-trace
Packit 26a39e
Information about the disposition of each target is printed (why the target is
Packit 26a39e
being rebuilt and what commands are run to rebuild it).
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-v\fR, \fB\-\-version\fR
Packit 26a39e
Print the version of the
Packit 26a39e
.B make
Packit 26a39e
program plus a copyright, a list of authors and a notice that there
Packit 26a39e
is no warranty.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-w\fR, \fB\-\-print\-directory\fR
Packit 26a39e
Print a message containing the working directory
Packit 26a39e
before and after other processing.
Packit 26a39e
This may be useful for tracking down errors from complicated nests of
Packit 26a39e
recursive
Packit 26a39e
.B make
Packit 26a39e
commands.
Packit 26a39e
.TP 0.5i
Packit 26a39e
.B \-\-no\-print\-directory
Packit 26a39e
Turn off
Packit 26a39e
.BR \-w ,
Packit 26a39e
even if it was turned on implicitly.
Packit 26a39e
.TP 0.5i
Packit 26a39e
\fB\-W\fR \fIfile\fR, \fB\-\-what\-if\fR=\fIfile\fR, \fB\-\-new\-file\fR=\fIfile\fR, \fB\-\-assume\-new\fR=\fIfile\fR
Packit 26a39e
Pretend that the target
Packit 26a39e
.I file
Packit 26a39e
has just been modified.
Packit 26a39e
When used with the
Packit 26a39e
.B \-n
Packit 26a39e
flag, this shows you what would happen if you were to modify that file.
Packit 26a39e
Without
Packit 26a39e
.BR \-n ,
Packit 26a39e
it is almost the same as running a
Packit 26a39e
.I touch
Packit 26a39e
command on the given file before running
Packit 26a39e
.BR make ,
Packit 26a39e
except that the modification time is changed only in the imagination of
Packit 26a39e
.BR make .
Packit 26a39e
.TP 0.5i
Packit 26a39e
.B \-\-warn\-undefined\-variables
Packit 26a39e
Warn when an undefined variable is referenced.
Packit 26a39e
.SH "EXIT STATUS"
Packit 26a39e
GNU
Packit 26a39e
.B make
Packit 26a39e
exits with a status of zero if all makefiles were successfully parsed
Packit 26a39e
and no targets that were built failed.  A status of one will be returned
Packit 26a39e
if the
Packit 26a39e
.B \-q
Packit 26a39e
flag was used and
Packit 26a39e
.B make
Packit 26a39e
determines that a target needs to be rebuilt.  A status of two will be
Packit 26a39e
returned if any errors were encountered.
Packit 26a39e
.SH "SEE ALSO"
Packit 26a39e
The full documentation for
Packit 26a39e
.B make
Packit 26a39e
is maintained as a Texinfo manual.  If the
Packit 26a39e
.B info
Packit 26a39e
and
Packit 26a39e
.B make
Packit 26a39e
programs are properly installed at your site, the command
Packit 26a39e
.IP
Packit 26a39e
.B info make
Packit 26a39e
.PP
Packit 26a39e
should give you access to the complete manual.
Packit 26a39e
.SH BUGS
Packit 26a39e
See the chapter ``Problems and Bugs'' in
Packit 26a39e
.IR "The GNU Make Manual" .
Packit 26a39e
.SH AUTHOR
Packit 26a39e
This manual page contributed by Dennis Morse of Stanford University.
Packit 26a39e
Further updates contributed by Mike Frysinger.  It has been reworked by Roland
Packit 26a39e
McGrath.  Maintained by Paul Smith.
Packit 26a39e
.SH "COPYRIGHT"
Packit 26a39e
Copyright \(co 1992-1993, 1996-2016 Free Software Foundation, Inc.
Packit 26a39e
This file is part of
Packit 26a39e
.IR "GNU make" .
Packit 26a39e
.LP
Packit 26a39e
GNU Make is free software; you can redistribute it and/or modify it under the
Packit 26a39e
terms of the GNU General Public License as published by the Free Software
Packit 26a39e
Foundation; either version 3 of the License, or (at your option) any later
Packit 26a39e
version.
Packit 26a39e
.LP
Packit 26a39e
GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
Packit 26a39e
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
Packit 26a39e
A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
Packit 26a39e
.LP
Packit 26a39e
You should have received a copy of the GNU General Public License along with
Packit 26a39e
this program.  If not, see
Packit 26a39e
.IR http://www.gnu.org/licenses/ .