In a makefile, declaring a fake target as a template

I want to declare my wildcard target as false, but false 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 goal to be fake because target files exist but just write:

 .PHONY: %.config 

does not work. I saw here that makeapp supports a different syntax that will help:

 $(phony %.config): ... 

but I can only use make, not makeapp.

Is there any way to do this with make?

+1
source share
1 answer

These are conflicting goals. A fake target is one that does not match the actual file. In your case, the file exists, but this is not really the goal.

I would suggest not using the configuration file name as the target. Instead, create a system based on one of the following:

 make something_else make CONFIG=something_else.config 
+2
source

All Articles