Below is my Makefile. I just want to do a comparision using && operator (or its equivalent) as shown in the following pseudocode.I want to run the following logic inside the "all" target
# if (CUR_PI_VERSION == LAST_PI_VERSION) && (CUR_GIT_VERSION == LAST_GIT_VERSION)
# print "everything matched. Nothing to do"
# else
# print "files not matched"
# run python script.
#
# How do I achieve this.
I have looked at other answers, but I couldn't get to the result I wished. I have attached my sample code for reference.
CUR_PI_VERSION:= "abc"
CUR_GIT_VERSION:= "cde"
LAST_PI_VERSION:= "abc"
LAST_GIT_VERSION:= "cde"
$(info $$CUR_GIT_VERSION is [${CUR_GIT_VERSION}])
$(info $$CUR_PI_VERSION is [${CUR_PI_VERSION}])
$(info $$LAST_GIT_VERSION is [${LAST_GIT_VERSION}])
$(info $$LAST_PI_VERSION is [${LAST_PI_VERSION}])
all:
# The pseudocode of what I want to do is as follows
# if (CUR_PI_VERSION == LAST_PI_VERSION) && (CUR_GIT_VERSION == LAST_GIT_VERSION)
# print "everything matched. Nothing to do"
# else
# print "files not matched"
# run python script.
#
# How do I achieve this.
#
ifeq ($(CUR_GIT_VERSION),$(LAST_GIT_VERSION))
ifeq ($(CUR_FPI_VERSION),$(LAST_FPI_VERSION))
echo "Everything matched, so don't need the make top"
endif
endif
Any help is highly appreciated.
You can try this :
all:
ifeq ($(CUR_PI_VERSION)@$(CUR_GIT_VERSION),$(LAST_PI_VERSION)@$(LAST_GIT_VERSION))
echo "Everything matched, so don't need the make top"
endif
Above test compares two concatenated strings (joined by @
):
$(CUR_PI_VERSION)@$(CUR_GIT_VERSION)
and
$(LAST_PI_VERSION)@$(LAST_GIT_VERSION)