|
From: | Noel Yap |
Subject: | Re: trouble with order rules in implicit rules |
Date: | Fri, 16 Apr 2004 14:57:32 -0400 |
User-agent: | Mozilla Thunderbird 0.5 (Windows/20040212) |
I think I've got it (de ja vu, actually, I think I ran into this some time ago and came to the same conclusion): Don't use order rules in implicit rules. Rather, use order rules only in static rules. If I change the makefile to: .PHONY: install install: foo/bar/baz .PRECIOUS: %/. %/.: mkdir -p $(@) foo/%: ./% @echo $(<) touch $(@) foo/bar/%: bar/% @echo $(<) touch $(@) foo/bar/baz: | foo/bar/. bar/baz: everything works perfectly. This sounds to me, though, that there's still a bug lurking somewhere. Noel Noel Yap wrote:
I think I see. If I switch the two rules and foo doesn't exist, everything works fine. But if foo exists and foo/bar doesn't, the same error occurs even if the rule for foo/bar/% comes first. If this is the defined behaviour, what needs to be done to get the action to be fired in the latter scenario?Thanks, Noel Paul D. Smith wrote:%% Noel Yap <address@hidden> writes: ny> I had thought that the better-matching rule would be the one used. I don't know what "better-matching" means, but the way make chooses a pattern rule is well-defined; from section "Introduction to Pattern Rules":The order in which pattern rules appear in the makefile is important since this is the order in which they are considered. Of equally applicable rules, only the first one found is used.I guess that's a little confusing, since "equally applicable" isn't defined anywhere. But, it refers to the last sentence:Note however, that a rule whose prerequisites actually exist or are mentioned always takes priority over a rule with prerequisites that must be made by chaining other implicit rules.Anyway, the short answer is that for basic pattern rules (not chained pattern rules) the first one appearing in the makefile is always used._______________________________________________ Help-make mailing list address@hidden http://mail.gnu.org/mailman/listinfo/help-make
[Prev in Thread] | Current Thread | [Next in Thread] |