bug-make
[Top][All Lists]
Advanced

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

Phony targets and pattern rules


From: Frank Heckenbach
Subject: Phony targets and pattern rules
Date: Sat, 06 Sep 2014 19:38:55 +0200

Is this the intended behaviour?

% cat Makefile
.PHONY: all foobar
all: foobar
foo%:; echo $@
% cat foobar
cat: foobar: No such file or directory
% make
make: Nothing to be done for 'all'.

(Wherease when "foobar" is not listed as .PHONY, echo is run.)

"make -d" reveals:

Considering target file 'foobar'.
File 'foobar' does not exist.
Finished prerequisites of target file 'foobar'.
Must remake target 'foobar'.
Successfully remade target file 'foobar'.

So make thinks foobar has an empty recipe, instead of using the
pattern rule.

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?



reply via email to

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