Implicit rules

The make program 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 shell file

header file

SCCS header 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

FORTRAN source file

SCCS FORTRAN source file

See ``Summary of default transformation path'' for a summary of the default transformation paths. If there are two paths connecting a pair of suffixes, the longer one is used only if the intermediate file exists or is named in the makefile.

Summary of default transformation path

If the file x.o is needed and an x.c is found in the makefile directory, the x.c would be compiled. If there is an x.l and an x.c file and the x.l has been modified (that is, has a later modification date than the x.c), then make runs lex on the x.l file to re-create the x.c file. Otherwise, just the x.c file would be recompiled to produce the x.o file. However, if there is no x.c but there is an x.l, make uses the direct link as shown in ``Summary of default transformation path''

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. AS, CC, CCC, F77, YACC, and LEX are the macro names of the compilers used by make. By specifically changing a compiler macro, a programmer can select which compiler is to be used. For example:

make CC=newcc

This causes the newcc command to be used instead of the usual C language compiler. The macros ASFLAGS, CFLAGS, CCFLAGS, F77FLAGS, YFLAGS, and LFLAGS can be set to cause these commands to be issued with optional flags. For example:

make "CFLAGS=-g"

This causes the cc command to include debugging information.

Next topic: Archive libraries
Previous topic: Suffixes and transformation rules

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003