make uses a table of suffixes and a set of transformation rules to supply default dependency information and implied commands. The default suffix list (in order) is as follows:
Object file
C source file
SCCS C source file
yacc C source grammar
SCCS yacc C source grammar
lex C source grammar
SCCS lex C source grammar
Assembler source file
SCCS assembler source file
Shell file
SCCS shel file
Header file
SCCS header file
FORTRAN source file
SCCS FORTRAN source file
C++ source file
SCCS C++ source file
yacc C++ source grammar
SCCS yacc C++ source grammar
lex C++ source grammar
SCCS lex C++ source grammar
Figure A-1 summarizes the default transformation paths. If two paths connect a pair of suffixes, the longer one is used only if the intermediate file exists or is named in the description.
If the file x.o is needed and an x.c is found in the description or directory, the x.o file would be compiled. If there is also an x.l, that source file is run through lex before compiling the result. However, if there is no x.c but there is an x.l, make discards the intermediate C language file and uses the direct link, as shown in Figure A-1.
It is possible to change the names of some of the compilers used in the default or the flag arguments with which they are invoked by knowing the macro names used. The compiler names are the macros AS
, CC
, C++C
, F77
, YACC
, and LEX
. The following command causes the newcc command to be used instead of the usual C language compiler.
$ make CC=newcc
The macros CFLAGS
, YFLAGS
, LFLAGS
, ASFLAGS
, FFLAGS
, and C++FLAGS
can be set to cause these commands to be issued with optional flags. Thus
$ make CFLAGS=-g