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.
This commit is contained in:
Kill Your TV 2014-12-17 20:24:36 +00:00
parent f4f6e74ea2
commit 21e3778e69
3 changed files with 14 additions and 15 deletions

View File

@ -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)

View File

@ -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

View File

@ -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