help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HELP] PHONY pattern rule makes the file w/ the same name


From: Kaz Kylheku
Subject: Re: [HELP] PHONY pattern rule makes the file w/ the same name
Date: Wed, 04 Oct 2023 23:50:33 -0700
User-agent: Roundcube Webmail/1.4.13

On 2023-10-04 07:55, Paul Smith wrote:
> It also means that implicit rules are not searched, for PHONY targets.

Is there a good reason for that? The manual mentions only performance:

  The implicit rule search (see Using Implicit Rules) is skipped
  for .PHONY targets. This is why declaring a target as .PHONY is
  good for performance, even if you are not worried about the
  actual file existing.

Say that I want to be able to say "make update-host-foo", such that
Make will run some remote commands on host "foo". For any host name:

  update-host-%:
          ssh $* some command

Problem is that while this works, Make is probing for the existence
of the file update-host-foo, and if that happens to exist, it will
not run the rule.

But if we add this:

  .PHONY: $(filter update-host-%,$(MAKECMDGOALS))

then the rule stops working, and it must be because of what you're
referring to above: if we make the target phony, then the implicit
rules are no longer searched.

In this case, it would be nice if they did!



reply via email to

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