Reputation: 6810
So, I'm kind of new to makefiles, but I have this rule in mine:
$(rc)/%.class: $(r)/%.java
echo $(strip $(findstring $*,"Robot RoboController"))
ifneq (,$(strip $(findstring $*,"Robot RoboController")))
echo "Robot or RoboController"
else
echo "other";
endif
My goal, is that if the matched text is Robot or RoboController, then it compiles in one way, otherwise, it compiles in a different way, unforunately, when I run makes I get the following output:
$ make Classes/RobotSuite/robot/Robot.class
echo Robot
Robot
echo "other";
other
$ make Classes/RobotSuite/robot/RoboComm.class
echo
echo "other";
other
It seems like no matter what I put into the ifneq
, it will erroneously evaluate it as equal to the null string. Can anyone explain why?
I am using the GNU Make v3.81, built for i686-pc-linux-gnu.
Upvotes: 0
Views: 217
Reputation: 14619
If you're using GNU Make, don't use ifneq
to solve this problem, use Target specific variable values.
Upvotes: 1