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

Kaz Kylheku <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <[email protected]>
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!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.