[Top][All Lists]

[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:53:38 +0200

Paul Smith wrote:

> On Sat, 2014-09-06 at 20:01 +0200, Frank Heckenbach wrote:
> > >         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.
> This "since" relates to how make thinks of the target, not necessarily
> how it is in real life.  By declaring it phony you have told make that
> it should not be considered a real file.  There may or may not be an
> actual file with the same name as the target but either way make will
> ignore it: since the target is always out of date there's no need to
> check its modified time etc.

I understand that, but AFAICS this has nothing to do with whether or
how the target is remade. I suppose the implication is that pattern
rules normally depend on files with names derived from the pattern
as in "%.o: %.c", but (AFAIK) that's no requirement, and there's
nothing preventing (as in my example) a pattern rule that depends on
nothing (or only on fixed-named targets which in turn may be phony

So I still don't think not being a file is a valid reason for not
matching pattern rules. But of course make doesn't need a reason.
If that's what it does, it's what it does. I just think the
documentation would be clearer to just state it without trying to
justify it (dubiously).

> > Also, the rule in question is not an implicit one (which I understand
> > to mean built-in rules), but one I gave explictly.
> "Implicit rule" doesn't mean built-in rules, although all built-in rules
> happen to be implicit rules.
> "Implicit rule" is a generic term for the combination of suffix and
> pattern rules; that is, any rule which doesn't name an explicit target
> (those are explicit rules).
> Apparently that should be made more clear.

I think so. E.g. the section title "Catalogue of Implicit Rules"
certainly makes it look like implicit means predefined. (Sure, the
next sentence speaks of "predefined implicit rules", but probably
the title should do so as well since it's more visible.)

> > 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.
> As above, saying "pattern rules (implicit or explicit)" is not right
> because there's no such thing as an "explicit pattern rule".

So "implicit rules (built-in or user-defined)" may be more correct

reply via email to

[Prev in Thread] Current Thread [Next in Thread]