Roland Ver. 4.5 Technické informace Strana 134

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 212
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 133
124 GNU make
Suppose the makefile mentions foo.c. For this target, make would have to consider
making it by linking an object file foo.c.o, or by C compilation-and-linking in one step from
foo.c.c, or by Pascal compilation-and-linking from foo.c.p, and many other possibilities.
We know these possibilities are ridiculous since foo.c is a C source file, not an executable.
If make did consider these possibilities, it would ultimately reject them, because files such
as foo.c.o and foo.c.p would not exist. But these possibilities are so numerous that make
would run very slowly if it had to consider them.
To gain speed, we have put various constraints on the way make considers match-anything
rules. There are two different constraints that can be applied, and each time you define a
match-anything rule you must choose one or the other for that rule.
One choice is to mark the match-anything rule as terminal by defining it with a double
colon. When a rule is terminal, it does not apply unless its prerequisites actually exist.
Prerequisites that could be made with other implicit rules are not good enough. In other
words, no further chaining is allowed beyond a terminal rule.
For example, the built-in implicit rules for extracting sources from RCS and SCCS files
are terminal; as a result, if the file foo.c,v does not exist, make will not even consider
trying to make it as an intermediate file from foo.c,v.o or from RCS/SCCS/s.foo.c,v.
RCS and SCCS files are generally ultimate source files, which should not be remade from
any other files; therefore, make can save time by not looking for ways to remake them.
If you do not mark the match-anything rule as terminal, then it is non-terminal. A
non-terminal match-anything rule cannot apply to a file name that indicates a specific type
of data. A file name indicates a specific type of data if some non-match-anything implicit
rule target matches it.
For example, the file name foo.c matches the target for the pattern rule ‘%.c : %.y’ (the
rule to run Yacc). Regardless of whether this rule is actually applicable (which happens only
if there is a file foo.y), the fact that its target matches is enough to prevent consideration of
any non-terminal match-anything rules for the file foo.c. Thus, make will not even consider
trying to make foo.c as an executable file from foo.c.o, foo.c.c, foo.c.p, etc.
The motivation for this constraint is that non-terminal match-anything rules are used
for making files containing specific types of data (such as executable files) and a file name
with a recognized suffix indicates some other specific type of data (such as a C source file).
Special built-in dummy pattern rules are provided solely to recognize certain file names
so that non-terminal match-anything rules will not be considered. These dummy rules have
no prerequisites and no recipes, and they are ignored for all other purposes. For example,
the built-in implicit rule
%.p :
exists to make sure that Pascal source files such as foo.p match a specific target pattern
and thereby prevent time from being wasted looking for foo.p.o or foo.p.c.
Dummy pattern rules such as the one for %.p are made for every suffix listed as valid
for use in suffix rules (see Section 10.7 [Old-Fashioned Suffix Rules], page 125).
10.5.6 Canceling Implicit Rules
You can override a built-in implicit rule (or one you have defined yourself) by defining a
new pattern rule with the same target and prerequisites, but a different recipe. When the
Zobrazit stránku 133
1 2 ... 129 130 131 132 133 134 135 136 137 138 139 ... 211 212

Komentáře k této Příručce

Žádné komentáře