make(1)

make(1)

the following series of targets to be made is generated:

--- pgm

with two dependents and an explicit rule to follow

 

--- a.o

(recursively) with an implicit dependent of a.c which matches the implicit rule .c.o

 

--- a.c

(recursively) with no implicit dependents and no implicit rules. This stops the recursion

 

 

and simply returns the last modi®cation time of the ®le a.c.

--- b.o

(recursively) with an implicit dependent of b.c which matches the implicit rule .c.o

 

--- b.c

(recursively) with no implicit dependents and no implicit rules. This stops the recursion

 

 

and merely returns the last modi®cation time of the ®le b.c.

In the de®nitions below, the word target refers to a target speci®ed in the make®le, an explicit dependent speci®ed in the make®le which becomes the target when make recurses on it, or an implicit dependent (generated as a result of locating an inference rule and ®le that match the suf®x of the target) which becomes the target when make recurses on it. The word dependent refers to an explicit dependent speci®ed in the make®le for a particular target, or an implicit dependent generated as a result of locating an appropriate inference rule and corresponding ®le that matches the suf®x of the target.

It may be helpful to think of target rules as user speci®ed rules for a particular target name, and inference rules as user or make speci®ed rules for a particular class of target names. It may also be helpful to remember that the value of the target name and its corresponding dependent names change as make recurses on both explicit and implicit dependents, and that inference rules are only applied to implicit dependents or to explicit dependents which do not have target rules de®ned for them in the make®le.

$@

The $@ macro is the full target name of the current target, or the archive ®lename part of a

 

library archive target. It is evaluated for both target and inference rules.

$%

The $% macro is only evaluated when the current target is an archive library member of

 

the form libname(member.o) or libname((entry)). In these cases, $@ evaluates to

 

libname and $% evaluates to member.o or the object ®le containing the symbol entry.

 

$% is evaluated for both target and inference rules.

$?

The $? macro is the list of dependents that are out-of-date with respect to the current tar-

 

get; essentially, those modules that have been rebuilt. It is evaluated for both target and

 

inference rules, but is usually only used in target rules. $? evaluates to one name only in

 

an inference rule, but may evaluate to more than one name in a target rule.

$<

In an inference rule, $< evaluates to the source ®le name that corresponds to the implicit

 

rule which matches the suf®x of the target being made. In other words, it is the ®le that is

 

out-of-date with respect to the target. In the .DEFAULT rule, the $< macro evaluates to

 

the current target name. $< is evaluated only for inference rules. Thus, in the .c.o rule,

 

the $< macro would evaluate to the .c ®le. An example for making optimized .o ®les

 

from .c ®les is:

 

.c.o:

 

cc -c -O $*.c

 

or:

 

.c.o:

 

cc -c -O $<

$*

The macro $* is the current target name with the suf®x deleted. It is evaluated only for

 

inference rules.

These ®ve macros can have alternative forms. When an uppercase D or F is appended to any of the ®ve macros, the meaning is changed to ``directory part'' for D and ``®le part'' for F. Thus, $(@D) refers to the directory part of the string $@. If there is no directory part, ./ is generated. When the $? macro contains more than one dependent name, the $(?D) expands to a list of directory name parts and the $(?F) expands to a list of the ®lename parts.

In addition to the built-in macros listed above, other commonly used macros are de®ned by make. These macros are used in the default inference rules, and can be displayed with the -poption. These macros can

HP-UX Release 11i: December 2000

− 8 −

Section 1515

m