Browse Source

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.
pull/118/head
Kill Your TV 10 years ago
parent
commit
21e3778e69
  1. 12
      Makefile
  2. 3
      Makefile.bsd
  3. 14
      Makefile.linux

12
Makefile

@ -25,18 +25,18 @@ all: obj $(SHLIB) $(I2PD)
obj: obj:
mkdir -p obj mkdir -p obj
obj/%.o : %.cpp %.h
$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
# weaker rule for building files without headers # weaker rule for building files without headers
obj/%.o : %.cpp 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)) $(I2PD): $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS)
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC)) $(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) -shared $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -shared -o $@ $^
clean: clean:
rm -fr obj $(I2PD) $(SHLIB) rm -fr obj $(I2PD) $(SHLIB)

3
Makefile.bsd

@ -1,5 +1,6 @@
CXX = g++ CXX = g++
CXXFLAGS = -g -Wall -O2 -std=c++11 CXXFLAGS = -O2
NEEDED_CXXFLAGS = -std=c++11
INCFLAGS = -I/usr/include/ -I/usr/local/include/ INCFLAGS = -I/usr/include/ -I/usr/local/include/
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib 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 LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread

14
Makefile.linux

@ -4,13 +4,13 @@ INCFLAGS =
# detect proper flag for c++11 support by gcc # detect proper flag for c++11 support by gcc
CXXVER := $(shell $(CXX) -dumpversion) CXXVER := $(shell $(CXX) -dumpversion)
ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # >= 4.10 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 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 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) else ifeq ($(shell expr match $(CXX) 'clang'),5)
CXXFLAGS += -std=c++11 NEEDED_CXXFLAGS += -std=c++11
else # not supported else # not supported
$(error Compiler too old) $(error Compiler too old)
endif endif
@ -34,10 +34,8 @@ IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(GREP) -c "64")
ifeq ($(USE_AESNI),yes) ifeq ($(USE_AESNI),yes)
ifeq ($(IS_64),1) ifeq ($(IS_64),1)
#check if AES-NI is supported by CPU #check if AES-NI is supported by CPU
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0) ifneq ($(shell grep -c aes /proc/cpuinfo),0)
CXXFLAGS += -maes -DAESNI CPU_FLAGS = -maes -DAESNI
else
$(warning "AESNI support enabled requested but not supported by this CPU")
endif endif
endif endif
endif endif

Loading…
Cancel
Save