16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Order of Rule Generation<br />

Since transitive closure allows make to generate new rules, it is important to<br />

understand the order in which this is done:<br />

Suffix Rules<br />

1. make searches for explicit rules in the order in which they appear, so explicit<br />

rules always take precedence.<br />

2. make reads metarules in the order in which they appear in the makefile. The<br />

first rule that appears in the makefile is the first one checked.<br />

3. New explicit metarules (as distinct from metarules generated by transitive<br />

closure) replace old ones. In other words, if your makefile contains an explicit<br />

rule like this one, it replaces the default rule in startup.mk:<br />

%$O : %.c<br />

rule1<br />

If you use the –v option, make prints a warning when it replaces a metarule.<br />

4. When transitive closure is calculated, the new metarules generated are added<br />

to the end of the list of possible metarules. Thus, make always finds the explicit<br />

rules first, so they take precedence over generated rules. You can use the –v<br />

option to see what rules make generates and the order in which they appear.<br />

5. make performs two passes through the rules. On the first pass it tries to find a<br />

match with an explicit rule in the makefile; if this does not succeed, make<br />

performs a second pass to find a match with an existing file.<br />

make treats targets that begin with a period and contain no slashes or percent<br />

signs as suffix rules. If there is only one period in the target, it is a single suffix<br />

inference rule. Targets with two periods are double-suffix inference rules. Suffix<br />

rules do not have prerequisites but do have commands associated with them.<br />

When make finds no explicit rule to update a target, it checks the suffix of the<br />

target (.s1) to be built against the suffix rules. make examines a prerequisite based<br />

on the basename of the target with the second suffix (.s2) appended, and if the<br />

target is out of date with respect to this prerequisite, make runs the recipe for that<br />

inference rule.<br />

Metarules take precedence over suffix rules.<br />

If the target to be built does not contain a suffix and there is no rule for the target,<br />

make checks the single suffix inference rules. The single suffix inference rules<br />

define how to build a target if make finds a rule with one of the single suffixes<br />

appended. A rule with one suffix .s2 defines how to build target from target.s2.<br />

make treats the other suffix (.s1) as null.<br />

For a suffix rule to work, the component suffixes must appear in the prerequisite list<br />

of the .SUFFIXES special target. You can turn off suffix rules by placing the following<br />

in your makefile:<br />

.SUFFIXES:<br />

This clears the prerequisites of the .SUFFIXES target, which prevents suffix rules<br />

from being enacted. The order that the suffixes appear in the .SUFFIXES rule<br />

determines the order in which make checks the suffix rules.<br />

The search algorithm used for suffix rules depends on whether the .P<strong>OS</strong>IX special<br />

target is specified. When .P<strong>OS</strong>IX is specified, the following steps describe the<br />

search algorithm for suffix rules:<br />

make<br />

Chapter 2. Shell command descriptions 401

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!