Programming Utilities Guide

Implicit Rules

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:

.o

Object file

.c

C source file

.c~

SCCS C source file

.y

yacc C source grammar

.y~

SCCS yacc C source grammar

.l

lex C source grammar

.l~

SCCS lex C source grammar

.s

Assembler source file

.s~

SCCS assembler source file

.sh

Shell file

.sh~

SCCS shel file

.h

Header file

.h~

SCCS header file

.f

FORTRAN source file

.f~

SCCS FORTRAN source file

.C

C++ source file

.C~

SCCS C++ source file

.Y

yacc C++ source grammar

.Y~

SCCS yacc C++ source grammar

.L

lex C++ source grammar

.L~

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.

Figure A-1 Summary of Default Transformation Path

Graphic

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

causes the cc command to include debugging information.