The commands in built-in implicit rules make liberal use of certain
predefined variables. You can alter these variables in the makefile,
with arguments to 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.
Here is a table of variables used as names of programs in built-in rules:
AR
ar
.
AS
as
.
CC
cc
.
CXX
g++
.
CO
co
.
CPP
$(CC) -E
.
FC
f77
.
GET
get
.
LEX
lex
.
PC
pc
.
YACC
yacc
.
YACCR
yacc -r
.
MAKEINFO
makeinfo
.
TEX
tex
.
TEXI2DVI
texi2dvi
.
WEAVE
weave
.
CWEAVE
cweave
.
TANGLE
tangle
.
CTANGLE
ctangle
.
RM
rm -f
.
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
rv
.
ASFLAGS
.s
or .S
file).
CFLAGS
CXXFLAGS
COFLAGS
co
program.
CPPFLAGS
FFLAGS
GFLAGS
get
program.
LDFLAGS
ld
.
LFLAGS
PFLAGS
RFLAGS
YFLAGS