This is an offshoot to my other question.
Is there something special I have to do in order to make this work with export variables?
So I'm running this off of a Makefile that includes a master Makefile in another location. In this local Makefile, I have:
include /path/to/master/Makefile/
export TOOL = A
Now in my Master Makefile I have:
ifeq ( $(TOOL), A )
echo "Tool A will be run..."
[syntax for toolA]
else
echo "Tool B will be run..."
[syntax for toolB]
endif
But when I run gmake, toolB is always run! I checked the variable $(TOOL) and it shows A. What am I doing wrong?
Thanks!!
EDIT: Adding Makefile example.
For my problem, moving the include to after the export fixed my problem. But this is an existing Makefile, and having the include at the very top has always worked!
The include statement is up top in the local, and all the exports at the bottom. Only my new export line fails. Does anyone know why?
Local Makefile
export TOOL A
include /path/to/master/Makefile
export VERSION IMP-IR5
Master Makefile
export VERSION IAP-100
ci:
ifeq ( $(TOOL), A )
echo "Tool A will be run..."
[syntax for toolA]
echo $(VERSION)
else
echo "Tool B will be run..."
[syntax for toolB]
echo $(VERSION)
endif
Output
echo "Tool A will be run..."
Tool A will be run...
echo IMP-IR5
IMP-IR5
But if I switch the top to lines in the local Makefile (like it was originally):
include /path/to/master/Makefile
export TOOL A
export VERSION IMP-IR5
I get:
echo "Tool B will be run..."
Tool B will be run...
echo IMP-IR5
IMP-IR5
Why does IMP-IR5 go through but not tool A? So confused...