DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing file interactions with make

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 shell 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

GREEK SMALL LETTER MUA summarizes 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 description.

Summary of default transformation path

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 would be run through lex before compiling the result. However, if there is no x.c but there is an x.l, make would discard the intermediate C language file and use the direct link as shown in GREEK SMALL LETTER MUA.

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 command

   $ make CC=newcc
will cause the newcc command to be used instead of the usual C language compiler. The macros CFLAGS, YFLAGS, LFLAGS, ASFLAGS, FFLAGS, and C++FLAGS may be set to cause these commands to be issued with optional flags. Thus
   $ make CFLAGS=-g
causes the cc command to include debugging information.
Next topic: Archive libraries
Previous topic: Suffixes and transformation rules

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004