In a makefile I'm trying to compare the target name with a string, and depending on this set a variable with a string or another. This example illustrates what I'm trying to do:
ifeq ($@,"Target_A")
THE_PATH="Path_a"
THE_TARGET=$@
else
THE_PATH="Path_b"
THE_TARGET=$@
endif
Target_A:
@echo $(THE_PATH)
@echo $(THE_TARGET)
Target_B:
@echo $(THE_PATH)
@echo $(THE_TARGET)
This is the output when I call make passing Target_A and when I call it passing Target_B:
$ make Target_A
Path_b
Target_A
$ make Target_B
Path_b
Target_B
The fact that I always get "Path_b" indicates the ifeq always evaluates to false, but you can see that $@ contained the right string.
Why doesn't this work?
make Target_A Target_B? - AProgrammer