MPE/iX Shell and Utilities Reference Manual, Vol 1

make(1) MPE/iX Shell and Utilities make(1)
make considers each meta-rule only once when performing transitive closure to avoid a situa-
tion where it loops forever. For example, if you have the rule
% : %.c
... rule body ...
the command
make file
causes make to look for file.c. If the meta-rules were not restricted and file.c did not
exist, then make would look for file.c.c, and then file.c.c.c, and so on. Because
make uses each meta-rule only once, this can’t happen.
make computes transitive closure once for each meta-rule head the first time the pattern
matches a target. When transitive closure is computed, make adds all the computed rules to
the rule set for that meta-rule head. For example, if you have the rules
% : %.o
recipe 1...
%.o:%c
recipe 2...
and you are making file, this target matches successfully against % causing make to compute
transitive closure for %. As a result of this computation, a new rule is created:
% : %.c
recipe 2...
.REMOVE target recipe for %.o, if not .PRECIOUS
recipe 1...
make executes this rule if file.o doesn’t exist. When make finishes the computation for the
rule head; it marks the rule head as transitive closure computed. Since make adds all possible
new rules to the rule set the first time the computation is done, it is not necessary to do it again
— nothing new is added. The term transitive closure is adapted from mathematical set theory.
Note: In set theory, if you have a set composed of pairs (a,b) and (b,c), then the set would be
transitively closed if (a,c) is also in the set. This is exactly what make does: it adds (a,c) to the
set of meta-rules if there are already rules (a,b) and (b,c) in the set.
The best way to understand how this works is to experiment with little make files with the –v
option specified. This shows you in detail what rules are being searched, when transitive clo-
sure is calculated and what rules are added.
Commands and Utilities 1-345