Re: Multiple rules for same target: what is the order of prerequisites in $^ and what does $< expand to?
Renaud Pacalet <[email protected]>
| Newsgroups | gmane.comp.gnu.make.general |
|---|---|
| Organization | Telecom ParisTech |
| Message-ID | <[email protected]> |
On 9/27/23 21:39, Philip Guenther wrote: > On Wed, Sep 27, 2023 at 7:52 AM Renaud Pacalet <[email protected] <mailto:[email protected]>> wrote: > > On 9/27/23 16:32, Bahman Movaqar wrote: > > On Wed, 2023-09-27 at 12:16 +0200, Renaud Pacalet wrote: > > > >> 3. Ignore all other implicit rules (which seems to contradict 4.11). > > > > Make only ignores the implicit rules for which there are > > explicit/static equivalents. > > > Per 10.1 "Using Implicit Rules", make will only use an implicit rule for a target if there isn't an explicit rule with a recipe. If a target has an explicit rule with a recipe, then make won't bother looking for implicit rules and so won't use them to add more prerequisites. > > Note that there are additional requirements on what implicit rules will be used even when they are considered: if they have a prerequisite that doesn't exist and make doesn't see how to build, then it'll ignore the rule. > > Thanks for your answer, Bahman. Not sure what "equivalent" means but with the following Makefile: > > %.a: %.b > > a.a: a.c > echo $^ > > > a.a has an explicit rule with a recipe so the %.a:%.b rule has no effect on the a.a target. Thanks a lot Philip. This is in line with my own conclusions. I guess my algorithm is thus probably correct. Note that the findings of Bahman (target-specific variables are taken into accounts even if declared in a pattern rule while an explicit rule with recipe exists) complicate things. I will continue my experiments and, if I find a way to explain all this clearly enough, I'll submit a proposal of improvement for 4.11 which I find misleading. Best regards, Renaud.