From 6681e25513a6f6891dab2b096086164f0a8a2b68 Mon Sep 17 00:00:00 2001 From: Kill Your TV Date: Thu, 30 Oct 2014 01:42:06 +0000 Subject: [PATCH] allow CXXFLAGS to be set without overwriting needed flags --- Makefile | 2 +- Makefile.bsd | 3 ++- Makefile.linux | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6e6433a1..4b5832e1 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ i2p: $(OBJECTS:obj/%=obj/%) .SUFFIXES: .c .cc .C .cpp .o obj/%.o : %.cpp - $(CXX) -o $@ $< -c $(CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) + $(CXX) -o $@ $< -c $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) obj: mkdir -p obj diff --git a/Makefile.bsd b/Makefile.bsd index 942b555d..d234d3f2 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -1,5 +1,6 @@ CXX = g++ -CXXFLAGS = -std=c++11 -O2 +CXXFLAGS = -O2 +NEEDED_CXXFLAGS = -std=c++11 include filelist.mk INCFLAGS = -I/usr/include/ -I/usr/local/include/ LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread diff --git a/Makefile.linux b/Makefile.linux index 5ed473dd..c7f3babe 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -5,11 +5,11 @@ FGREP = fgrep IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(FGREP) -c "64") ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # >= 4.10 -CXXFLAGS += -std=c++11 +NEEDED_CXXFLAGS += -std=c++11 else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7 -CXXFLAGS += -std=c++11 +NEEDED_CXXFLAGS += -std=c++11 else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6 -CXXFLAGS += -std=c++0x +NEEDED_CXXFLAGS += -std=c++0x else # not supported $(error Compiler too old) endif