m

make(1)

make(1)

SHELL=/usr/bin/sh

or a suitable equivalent should be put in the macro de®nition section of the make®le.

Suf®xes

Target and/or dependent names often have suf®xes. Knowledge about certain suf®xes is built into make and used to identify appropriate inference rules to be applied to update a target (see the section on Inference Rules). The current default list of suf®xes is:

.o .c .cÄ .C .CÄ .cxx .cxxÄ .cpp .cppÄ .cc .ccÄ

.y .yÄ .l .lÄ .L .LÄ .Y .YÄ .s .sÄ .sh .shÄ

.h .hÄ .H .HÄ .p .pÄ .f .fÄ .r .rÄ

These suf®xes are de®ned as the dependents of the special built-in target .SUFFIXES. This is done automatically by make.

Additional suf®xes can be speci®ed in a make®le as the dependents list for .SUFFIXES. These additional values are added to the default values. Multiple suf®x lists accumulate. The order of the suf®x list is signi®cant (see the Inference Rules section). If the user wishes to change the order of the suf®xes, he must ®rst de®ne .SUFFIXES with a null dependent list, which clears the current value for .SUFFIXES, and then de®ne .SUFFIXES with the suf®xes in the desired order. The list of suf®xes built into make on any machine can be displayed by:

make -fp - 2>/dev/null </dev/null

The list of built-in suf®xes incorporated with the de®nitions in a given make®le called mymakefile can be displayed by:

make -fp mymakefile 2>/dev/null </dev/null

Inference Rules

Certain target or dependent names (such as those ending with .o) have inferable dependents such as .c and .s, etc. If no update commands for such a name appear in the make®le, and if an inferable dependent ®le exists, that dependent ®le is compiled to update the target. In this case, make has inference rules that allow building ®les from other ®les by examining the suf®xes and determining an appropriate inference rule to use. There are currently default inference rules de®ned for:

Single Suffix Rules

.c .cÄ

.C .CÄ .cxx .cxxÄ .cpp .cppÄ .cc .ccÄ

.sh .shÄ

.p .pÄ

.f .fÄ

.r .rÄ

Double Suffix Rules

.c.o .cÄ.o .cÄ.c .c.a .cÄ.a

.C.o .CÄ.o .CÄ.C .C.a .CÄ.a

.cxx.o .cxxÄ.o .cxxÄ.cxx .cxx.a .cxxÄ.a

.cpp.o .cppÄ.o .cppÄ.cpp .cpp.a .cppÄ.a

.cc.o .ccÄ.o .ccÄ.cc .cc.a .ccÄ.a

.s.o .sÄ.o .sÄ.a

.p.o .pÄ.o .pÄ.p .p.a .pÄ.a

.f.o .fÄ.o .fÄ.f .f.a .fÄ.a

.r.o .rÄ.o .rÄ.r .r.a .rÄ.a

.y.o .yÄ.o .y.c .yÄ.c

.l.o .lÄ.o .l.c

.hÄ.h .HÄ.H .hxxÄ.hxx .hppÄ.hpp

.C.o .CÄ.o .C.a .CÄ.a

.L.C .L.o .LÄ.C .LÄ.L .LÄ.o

.Y.C .Y.o .YÄ.C .YÄ.Y .YÄ.o

Double suf®x inference rules (.c.o) de®ne how to build x.o from x.c. Single suf®x inference rules (.c) de®ne how to build x from x.c. In effect, the ®rst suf®x is null. Single suf®x rules are useful for building targets from only one source ®le; e.g., shell procedures and simple C programs.

Section 1512

− 5 −

HP-UX Release 11i: December 2000