I have this minimal Makefile:
.PHONY: foo.bar
%.bar:
echo $*
I run $ make foo.bar
and I expect it to match the %.bar pattern, populate the stem $* with "foo", and echo "foo" all the time because foo.bar is a phony target. However, the output I get is
make: Nothing to be done for 'foo.bar'.
Am I missing something here?
EDIT:
I forgot to mention that removing the .PHONY line performs the expected behavior where it echo's "foo", and also making it an explicit target "foo.bar" without the pattern matching. Both of which make perfect sense since in the former, the file, foo.bar, doesn't exist and in the latter, well, it's just explicit.
EDIT:
This might be a duplicate of this actually: When declaring the pattern rule as PHONY, it is not triggered. Here is something that works:
.PHONY: foo.bar
foo.bar: %.bar:
echo $*
For whatever reason the target/dependency line is more like target/(dependency|target)/dependency. Can someone explain this or point me to the documentation?