make: Static versus Implicit
1
1 4.12.2 Static Pattern Rules versus Implicit Rules
1 -------------------------------------------------
1
1 A static pattern rule has much in common with an implicit rule defined
11 as a pattern rule (⇒Defining and Redefining Pattern Rules Pattern
Rules.). Both have a pattern for the target and patterns for
1 constructing the names of prerequisites. The difference is in how
1 'make' decides _when_ the rule applies.
1
1 An implicit rule _can_ apply to any target that matches its pattern,
1 but it _does_ apply only when the target has no recipe otherwise
1 specified, and only when the prerequisites can be found. If more than
1 one implicit rule appears applicable, only one applies; the choice
1 depends on the order of rules.
1
1 By contrast, a static pattern rule applies to the precise list of
1 targets that you specify in the rule. It cannot apply to any other
1 target and it invariably does apply to each of the targets specified.
1 If two conflicting rules apply, and both have recipes, that's an error.
1
1 The static pattern rule can be better than an implicit rule for these
1 reasons:
1
1 * You may wish to override the usual implicit rule for a few files
1 whose names cannot be categorized syntactically but can be given in
1 an explicit list.
1
1 * If you cannot be sure of the precise contents of the directories
1 you are using, you may not be sure which other irrelevant files
1 might lead 'make' to use the wrong implicit rule. The choice might
1 depend on the order in which the implicit rule search is done.
1 With static pattern rules, there is no uncertainty: each rule
1 applies to precisely the targets specified.
1