VER_VALUE := 22.10.0.0
VER_MAJOR := $(shell echo $(VER_VALUE) | cut -f1 -d.)
VER_MINOR := $(shell echo $(VER_VALUE) | cut -f2 -d.)
# compare major version >= 22
VER_GE_22 := $(shell [ $(VER_MAJOR) -ge 22 ] && echo true)
ifeq ($(VER_GE_22),true)
STRING1="I am OK"
else
STRING1="I am NOT OK"
endif
# compare case 2
VER_GE_2220:= $(shell [ $(VER_MAJOR) -gt 22 -o \( $(VER_MAJOR) -eq 22 -a $(VER_MAJOR) -ge 10 \) ] && echo true)
ifeq ($(VER_GE_2220),true)
STRING2="I am OK"
else
STRING2="I am NOT OK"
endif
# compare case 3: bind 2 commands together
ifeq ($(shell [ `echo $(VER_VALUE) | cut -f1 -d.` -ge 22 ] && echo true), true)
STRING3="I am OK"
else
STRING3="I am NOT OK"
endif
# compare case 4
VER_VALUE=221000
ifeq ($(shell [ $(VER_VALUE) -ge 221000 ] && echo true), true)
STRING4="I am OK"
else
STRING4="I am NOT OK"
endif
all:
@echo $(STRING1)
@echo $(STRING2)
@echo $(STRING3)
@echo $(STRING4)
网友评论