I have encountered a strange problem with make and ifeq evaluations and $@.
I want to set specific link libraries based on the target the user supplies when running make.
So I did the following in my makefile:
Foo = bar
ifeq ($@,$(Foo))
Lib = “Equal”
else
Lib = “Not equal”
endif
Later on my compile line I echo’d out the results as:
@ echo “Results of compare” “<”$@">" “<”$(Foo)">" $(Lib)
So I issue ‘make bar’ on the command line and get an output of:
Results of compare Not Equal.
No matter what I do, the ifeq always evaluates to Not Equal.
Even if I do something like:
Input = $@
Blah = $(filter bar, $(Input))
Foo = bar
ifeq ($(Blah),$(Foo))
Lib = “Equal”
else
Lib = “Not Equal”
endif
It still comes out as Not Equal even tho Blah prints out as ‘bar’.
Now I know that ifeq is not broken because if I do:
Blah = bar
Foo = bar
ifeq ($(Blah),$(Foo))
Lib = “Equal”
else
Lib = “Not Equal”
endif
This does evaluate to Equal.
So I’m very very confused about how Make is treating the $@ parameter when converting it to a string. Esp since it can filter out bar part but yet it can’t make the two strings manage to be equal.
Anyone have any idea what’s up with this?
TIA,
Tim