分类: LINUX
2008-10-08 16:32:18
2) macros that define standard compilers and options
3) suffix rules for finding required files when building targets
4) a list of known suffixes
To get a listing of all the built-in macros and rules, enter the command:
% make -p -f /dev/null [| less]
Depending on your platform, there may be nearly a thousand lines of definitions, so you might want to pipe this to less, or redirect the output to a file.
make
, or in the environment to
alter how the implicit rules work without redefining the rules
themselves. You can cancel all variables used by implicit rules with
the `-R' or `--no-builtin-variables' option.
For example, the command used to compile a C source file actually says `$(CC) -c $(CFLAGS) $(CPPFLAGS)'. The default values of the variables used are `cc' and nothing, resulting in the command `cc -c'. By redefining `CC' to `ncc', you could cause `ncc' to be used for all C compilations performed by the implicit rule. By redefining `CFLAGS' to be `-g', you could pass the `-g' option to each compilation. All implicit rules that do C compilation use `$(CC)' to get the program name for the compiler and all include `$(CFLAGS)' among the arguments given to the compiler.
The variables used in implicit rules fall into two classes: those that are
names of programs (like CC
) and those that contain arguments for the
programs (like CFLAGS
). (The “name of a program” may also contain
some command arguments, but it must start with an actual executable program
name.) If a variable value contains more than one argument, separate them
with spaces.
The following tables describe of some of the more commonly-used predefined
variables. This list is not exhaustive, and the default values shown here may
not be what are selected by make
for your environment. To see the
complete list of predefined variables for your instance of GNU make
you
can run `make -p' in a directory with no makefiles.
Here is a table of some of the more common variables used as names of programs in built-in rules: makefiles.
AR
AS
CC
CO
CXX
CO
CPP
FC
GET
LEX
YACC
LINT
M2C
PC
MAKEINFO
TEX
TEXI2DVI
WEAVE
CWEAVE
TANGLE
CTANGLE
RM
Here is a table of variables whose values are additional arguments for the programs above. The default values for all of these is the empty string, unless otherwise noted.
ARFLAGS
ASFLAGS
CFLAGS
CXXFLAGS
COFLAGS
co
program.
CPPFLAGS
FFLAGS
GFLAGS
get
program.
LDFLAGS
LFLAGS
YFLAGS
PFLAGS
RFLAGS
LINTFLAGS