Reputation: 461
I am adding some conditional flag which depends upon the gcc version Below if the makefile snippet
CPPFLAGS := -O0 -g
CXXFLAGS := -fPIC
GCCVERSION = $(shell gcc --version | grep ^gcc |cut -b11-16)
ifneq ($(GCCVERSION),"4.1.2")
CPPFLAGS += -std=c++0x
CXXFLAGS += -m64
endif
The ifneq condition fails. I have checked that my $(GCCVERSION)=4.1.2 as expected.
EDIT:
I have already tried below options
ifneq ($(GCCVERSION),4.1.2)
ifneq ($(GCCVERSION),'4.1.2')
ifneq ("$(GCCVERSION)","4.1.2")
Upvotes: 0
Views: 400
Reputation: 973
You need to strip $(GCCVERSION)
:
CPPFLAGS := -O0 -g
CXXFLAGS := -fPIC
GCCVERSION = $(shell gcc --version | grep ^gcc |cut -b11-16)
ifneq ($(strip $(GCCVERSION)),4.1.2)
CPPFLAGS += -std=c++0x
CXXFLAGS += -m64
endif
Upvotes: 2