[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Phony targets and pattern rules
From: |
Frank Heckenbach |
Subject: |
Re: Phony targets and pattern rules |
Date: |
Sat, 06 Sep 2014 20:01:09 +0200 |
Paul Smith wrote:
> On Sat, 2014-09-06 at 19:38 +0200, Frank Heckenbach wrote:
> > I know that specific rules take precendence over pattern rules (e.g.
> > if I had a rule "foobar:;", I wouldn't expect the echo to run), as
> > the documentation says: "The rules you write take precedence over
> > those that are built in." But here foobar has no specific rule, just
> > appears as a pseudo-prerequisite of ".PHONY".
> >
> > Apparently this is enough to prevent make from using the pattern
> > rule as well, but I couldn't find this mentioned in the
> > documentation, so I wonder whether it's meant to be so or a bug?
>
> The manual chapter on phony targets sez:
>
> Since it knows that phony targets do not name actual files that
> could be remade from other files, `make' skips the implicit rule
> search for phony targets (*note Implicit Rules::). This is why
> declaring a target phony is good for performance, even if you
> are not worried about the actual file existing.
Well, "foobar" (in my example) is not an actual *file*, but yet it
can be "remade" just like any other phony target. Also, the rule in
question is not an implicit one (which I understand to mean built-in
rules), but one I gave explictly.
So when I read this paragraph I didn't think it applied. But I
gather from your reaction that the behaviour of make is as intended,
so I think the documentation could be made clearer here. I'd omit
the "Since ..." part as I don't think it really applies (see above)
and s/implicit/pattern/, so e.g. just:
Phone targets are not eligible for pattern rules (implicit or
explicit). This is why declaring a target phony is good for
performance, even if you are not worried about the actual file
existing.