From 21e3778e6970b388b10317c8fd33ec2fff1f4edf Mon Sep 17 00:00:00 2001 From: Kill Your TV Date: Wed, 17 Dec 2014 20:24:36 +0000 Subject: [PATCH] Revert the 'clean-up' commits so that custom build-time flags can be set These commits removed the 'NEEDED*' vars which were added so that CXX* and LDFLAGS could be specified at build time. By doing away with these and using solely CXXFLAGS and LDFLAGS, special flags cannot be added. Indeed, specifying your own CXXFLAGS would cause the build to fail. We want the build flags to be APPENDED, not overwritten. --- Makefile | 12 ++++++------ Makefile.bsd | 3 ++- Makefile.linux | 14 ++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 7e512cb4..54cd1b6f 100644 --- a/Makefile +++ b/Makefile @@ -25,18 +25,18 @@ all: obj $(SHLIB) $(I2PD) obj: mkdir -p obj -obj/%.o : %.cpp %.h - $(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $< - # weaker rule for building files without headers obj/%.o : %.cpp - $(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $< + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $< + +obj/%.o : %.cpp %.h + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $< $(I2PD): $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC)) - $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) + $(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS) $(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC)) - $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) -shared + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -shared -o $@ $^ clean: rm -fr obj $(I2PD) $(SHLIB) diff --git a/Makefile.bsd b/Makefile.bsd index 12370c3b..f59b40e3 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -1,5 +1,6 @@ CXX = g++ -CXXFLAGS = -g -Wall -O2 -std=c++11 +CXXFLAGS = -O2 +NEEDED_CXXFLAGS = -std=c++11 INCFLAGS = -I/usr/include/ -I/usr/local/include/ LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread diff --git a/Makefile.linux b/Makefile.linux index 39047415..154c6ffd 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -4,13 +4,13 @@ INCFLAGS = # detect proper flag for c++11 support by gcc CXXVER := $(shell $(CXX) -dumpversion) 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 ifeq ($(shell expr match $(CXX) 'clang'),5) - CXXFLAGS += -std=c++11 +NEEDED_CXXFLAGS += -std=c++11 else # not supported $(error Compiler too old) endif @@ -34,10 +34,8 @@ IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(GREP) -c "64") ifeq ($(USE_AESNI),yes) ifeq ($(IS_64),1) #check if AES-NI is supported by CPU -ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0) - CXXFLAGS += -maes -DAESNI -else - $(warning "AESNI support enabled requested but not supported by this CPU") +ifneq ($(shell grep -c aes /proc/cpuinfo),0) + CPU_FLAGS = -maes -DAESNI endif endif endif