home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
info
/
make.info-5
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-11-12
|
48KB
|
861 lines
This is Info file make.info, produced by Makeinfo-1.55 from the input
file ./make.texinfo.
This file documents the GNU Make utility, which determines
automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them.
This is Edition 0.47, last updated 1 November 1994, of `The GNU Make
Manual', for `make', Version 3.72 Beta.
Copyright (C) 1988, '89, '90, '91, '92, '93, '94 Free Software
Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Free Software Foundation.
File: make.info, Node: Overriding, Next: Testing, Prev: Avoiding Compilation, Up: Running
Overriding Variables
====================
An argument that contains `=' specifies the value of a variable:
`V=X' sets the value of the variable V to X. If you specify a value in
this way, all ordinary assignments of the same variable in the makefile
are ignored; we say they have been "overridden" by the command line
argument.
The most common way to use this facility is to pass extra flags to
compilers. For example, in a properly written makefile, the variable
`CFLAGS' is included in each command that runs the C compiler, so a
file `foo.c' would be compiled something like this:
cc -c $(CFLAGS) foo.c
Thus, whatever value you set for `CFLAGS' affects each compilation
that occurs. The makefile probably specifies the usual value for
`CFLAGS', like this:
CFLAGS=-g
Each time you run `make', you can override this value if you wish.
For example, if you say `make CFLAGS='-g -O'', each C compilation will
be done with `cc -c -g -O'. (This illustrates how you can use quoting
in the shell to enclose spaces and other special characters in the
value of a variable when you override it.)
The variable `CFLAGS' is only one of many standard variables that
exist just so that you can change them this way. *Note Variables Used
by Implicit Rules: Implicit Variables, for a complete list.
You can also program the makefile to look at additional variables of
your own, giving the user the ability to control other aspects of how
the makefile works by changing the variables.
When you override a variable with a command argument, you can define
either a recursively-expanded variable or a simply-expanded variable.
The examples shown above make a recursively-expanded variable; to make a
simply-expanded variable, write `:=' instead of `='. But, unless you
want to include a variable reference or function call in the *value*
that you specify, it makes no difference which kind of variable you
create.
There is one way that the makefile can change a variable that you
have overridden. This is to use the `override' directive, which is a
line that looks like this: `override VARIABLE = VALUE' (*note The
`override' Directive: Override Directive.).
File: make.info, Node: Testing, Next: Options Summary, Prev: Overriding, Up: Running
Testing the Compilation of a Program
====================================
Normally, when an error happens in executing a shell command, `make'
gives up immediately, returning a nonzero status. No further commands
are executed for any target. The error implies that the goal cannot be
correctly remade, and `make' reports this as soon as it knows.
When you are compiling a program that you have just changed, this is
not what you want. Instead, you would rather that `make' try compiling
every file that can be tried, to show you as many compilation errors as
possible.
On these occasions, you should use the `-k' or `--keep-going' flag.
This tells `make' to continue to consider the other dependencies of the
pending targets, remaking them if necessary, before it gives up and
returns nonzero status. For example, after an error in compiling one
object file, `make -k' will continue compiling other object files even
though it already knows that linking them will be impossible. In
addition to continuing after failed shell commands, `make -k' will
continue as much as possible after discovering that it does not know
how to make a target or dependency file. This will always cause an
error message, but without `-k', it is a fatal error (*note Summary of
Options: Options Summary.).
The usual behavior of `make' assumes that your purpose is to get the
goals up to date; once `make' learns that this is impossible, it might
as well report the failure immediately. The `-k' flag says that the
real purpose is to test as much as possible of the changes made in the
program, perhaps to find several independent problems so that you can
correct them all before the next attempt to compile. This is why Emacs'
`M-x compile' command passes the `-k' flag by default.
File: make.info, Node: Options Summary, Prev: Testing, Up: Running
Summary of Options
==================
Here is a table of all the options `make' understands:
These options are ignored for compatibility with other versions of
`make'.
`-C DIR'
`--directory=DIR'
Change to directory DIR before reading the makefiles. If multiple
`-C' options are specified, each is interpreted relative to the
previous one: `-C / -C etc' is equivalent to `-C /etc'. This is
typically used with recursive invocations of `make' (*note
Recursive Use of `make': Recursion.).
`--debug'
Print debugging information in addition to normal processing. The
debugging information says which files are being considered for
remaking, which file-times are being compared and with what
results, which files actually need to be remade, which implicit
rules are considered and which are applied--everything interesting
about how `make' decides what to do.
`--environment-overrides'
Give variables taken from the environment precedence over
variables from makefiles. *Note Variables from the Environment:
Environment.
`-f FILE'
`--file=FILE'
`--makefile=FILE'
Read the file named FILE as a makefile. *Note Writing Makefiles:
Makefiles.
`--help'
Remind you of the options that `make' understands and then exit.
`--ignore-errors'
Ignore all errors in commands executed to remake files. *Note
Errors in Commands: Errors.
`-I DIR'
`--include-dir=DIR'
Specifies a directory DIR to search for included makefiles. *Note
Including Other Makefiles: Include. If several `-I' options are
used to specify several directories, the directories are searched
in the order specified.
`-j [JOBS]'
`--jobs=[JOBS]'
Specifies the number of jobs (commands) to run simultaneously.
With no argument, `make' runs as many jobs simultaneously as
possible. If there is more than one `-j' option, the last one is
effective. *Note Parallel Execution: Parallel, for more
information on how commands are run.
`--keep-going'
Continue as much as possible after an error. While the target that
failed, and those that depend on it, cannot be remade, the other
dependencies of these targets can be processed all the same.
*Note Testing the Compilation of a Program: Testing.
`-l [LOAD]'
`--load-average[=LOAD]'
`--max-load[=LOAD]'
Specifies that no new jobs (commands) should be started if there
are other jobs running and the load average is at least LOAD (a
floating-point number). With no argument, removes a previous load
limit. *Note Parallel Execution: Parallel.
`--just-print'
`--dry-run'
`--recon'
Print the commands that would be executed, but do not execute them.
*Note Instead of Executing the Commands: Instead of Execution.
`-o FILE'
`--old-file=FILE'
`--assu