So I need to make sure that if I am cross-compiling for a specific target that a shell variable is set. If the variable is not set then make should display a message and then exit.
I have the following rule in my makefile:
.PHONY: checksource
all: checksource default
checksource:
$(if $(and $(ifeq ($(CROSS_COMPILE), whatever)), $(ifeq ($(VARIABLE),))), \
($(shell echo "Error! VARIABLE not defined!") \
$(shell exit 2)))
If $CROSS_COMPILE is set to whatever:
$> echo $CROSS_COMPILE
whatever
$>
and $VARIABLE is not defined:
$> echo $VARIABLE
$>
It does not exit the make and the default target is built. Okay I know that I could just use nested ifeq to do this but I want to make it pretty (and learn a bit more about makefiles).
Help!
advTHANKSance
M