02.05.2013 Views

Description - Mks.com

Description - Mks.com

Description - Mks.com

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.

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 meta-rule.<br />

4. When transitive closure is calculated, the new meta-rules generated are added to the end of<br />

the list of possible meta-rules. Thus, make always finds the explicit rules first, so they take<br />

precedence over generated rules. You can use the -v option to see what rules make<br />

generates and the order they appear in.<br />

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

with an explicit rule in the makefile; if this does not succeed, make performs a second pass<br />

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

Suffix Rules<br />

make treats targets that begin with a period and contain no slashes or percent signs as suffix rules.<br />

If there is only one period in the target, it is a single-suffix inference rule. Targets with two periods<br />

are double-suffix inference rules. Suffix rules do not have prerequisites but do have <strong>com</strong>mands<br />

associated with them.<br />

When make finds no explicit rule to update a target, it checks the suffix of that target (.s1) against<br />

the suffix rules. make examines a prerequisite based on the base name of the target with the<br />

second suffix (.s2) appended, and if the target is out-of-date with respect to this prerequisite, make<br />

executes the recipe for that inference rule.<br />

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

single suffix inference rules. The single suffix inference rules define how to build a target 'br 'ne 5v<br />

if make finds a rule with one of the single suffixes appended. A rule with one suffix .s2 defines how<br />

to build target from target.s2.<br />

Any suffixes used in a suffix rule must appear as a prerequisite of the special target .SUFFIXES.<br />

The order that the suffixes appear in the .SUFFIXES rule determines the order make checks the<br />

suffix rules in. New suffixes and suffix rules are added to the existing list. To turn off the suffix<br />

rules, place<br />

.SUFFIXES:<br />

in your makefile. This clears the prerequisites of the .SUFFIXES target and prevents the enaction<br />

of any suffix rules.<br />

The search algorithm used for suffix rules depends on whether or not the .POSIX special target is<br />

418 of 457

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

Saved successfully!

Ooh no, something went wrong!