when using a makefile, I want the following to be possible:
make clean make Clean make CLean make CLEan make CLEAn make ...
and everyone should do the same in my makefile.
(i.e. I donβt want the targets to be case sensitive)
Of course, I could write everything, possibly like this:
.PHONY clean Clean CLean CLEan CLEAn ... clean Clean CLean CLEan CLEAn ...: $(DELETE_STUFF)
but I think you can understand why this is undesirable.
I know that βmakeβ has a built-in macro called MAKECMDGOALS, which will be equal to the type that you type after you type make.
for example, running 'make clean all backup' $(MAKECMDGOALS) = "clean all backup"
I tried to do this at the top of my makefile:
MAKECMDGOALS:= $(shell echo $(MAKECMDGOALS) | tr "[:upper:]" "[:lower:]")
it changes the variable to all lowercase letters, but it will still only invoke the rule for the target.
I even tried to redefine it as follows:
override MAKECMDGOALS:= $(shell echo $(MAKECMDGOALS) | tr "[:upper:]" "[:lower:]")
in the hope that this will be done earlier, but will not be successful.
I was going to create such a goal:
$(MAKECMDGOALS): MAKECMDGOALS:= $(shell echo $(MAKECMDGOALS) | tr "[:upper:]" "[:lower:]")
I know this is a stupid detail to make a fuss about, but of course there must be a right way?