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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

make<br />

and:<br />

%.c : %.y<br />

... rule body ...<br />

c When you specify:<br />

make file.o<br />

make uses the first metarule to look for file.c. If it can’t find an explicit rule to build<br />

file.c, it again looks through the metarules and finds the rule that tells it to look for<br />

file.y.<br />

make allows each metarule to be applied only once when performing transitive<br />

closure to avoid a situation where it loops forever. (For example, if you have the<br />

rule:<br />

% : %.c<br />

... rule body ...<br />

the command:<br />

make file<br />

causes make to look for file.c. If the metarules were not restricted and file.c did not<br />

exist, then make would look for file.c.c, and then file.c.c.c, and so on. Because<br />

each metarule is applied only once, this can’t happen.)<br />

Transitive closure is computed once for each metarule head the first time the<br />

pattern matches a target. When transitive closure is computed, all the computed<br />

rules are added to the rule set for that metarule head. For example, if you have the<br />

rules:<br />

% : %.o<br />

recipe 1...<br />

%.o : %c<br />

recipe 2...<br />

and you are making file, this target matches successfully against % causing<br />

transitive closure to be computed for %. As a result of this computation, a new rule<br />

is created:<br />

% : %.c<br />

recipe 2...<br />

recipe from .REMOVE target for %.o, if not .PRECIOUS<br />

recipe 1...<br />

which is executed if file.o doesn’t exist. When the computation for the rule head<br />

has been done, it is marked as transitive closure computed. Since all possible new<br />

rules have been added to the rule set the first time the computation is done, it is not<br />

necessary to do it again: Nothing new is added. The term transitive closure is<br />

adapted from the mathematical set theory.<br />

Note: In set theory, if you have a set composed of pairs (a,b) and (b,c), then the<br />

set would be transitively closed if (a,c) is also in the set.<br />

The best way to understand how this works is to experiment with little make files<br />

with the –v flag specified. This shows you in detail what rules are being searched,<br />

when transitive closure is calculated, and what rules are added.<br />

400 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

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

Saved successfully!

Ooh no, something went wrong!