in a makefile, declaring a phony target as a wildcard
I want to declare my wildcard target as phony, but phony doesn't support wildcards:
My makefile:
%.config:
gcc <<compile>>
I want the user to be able to use my makefile to compile the project, using a specific configuration file:
make something.config
make something_else.config
obviously, I need my target to be phony, becuase the target files exist, but simply writing:
.PHONY: %.config
doesn't work. I've seen here that makeapp supports another syntax, that would help:
$(phony %.config): ...
but I can only use make, and not makeapp.
Is there any way to do it with make?
These are conflicting aims. A phony target is one that doesn't correspond to a real file. In your case, the file exists, but it's not really a target.
I would suggest not using the name of the config file as the target. Instead, construct a system based on one of the following:
make something_else
make CONFIG=something_else.config
链接地址: http://www.djcxy.com/p/64114.html
上一篇: 只有GNU Make中的目标