Skip to content

Commit 21e3778

Browse files
committed
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.
1 parent f4f6e74 commit 21e3778

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ all: obj $(SHLIB) $(I2PD)
2525
obj:
2626
mkdir -p obj
2727

28-
obj/%.o : %.cpp %.h
29-
$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
30-
3128
# weaker rule for building files without headers
3229
obj/%.o : %.cpp
33-
$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
30+
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $<
31+
32+
obj/%.o : %.cpp %.h
33+
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $<
3434

3535
$(I2PD): $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
36-
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
36+
$(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS)
3737

3838
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
39-
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) -shared
39+
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -shared -o $@ $^
4040

4141
clean:
4242
rm -fr obj $(I2PD) $(SHLIB)

Makefile.bsd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
CXX = g++
2-
CXXFLAGS = -g -Wall -O2 -std=c++11
2+
CXXFLAGS = -O2
3+
NEEDED_CXXFLAGS = -std=c++11
34
INCFLAGS = -I/usr/include/ -I/usr/local/include/
45
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
56
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread

Makefile.linux

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ INCFLAGS =
44
# detect proper flag for c++11 support by gcc
55
CXXVER := $(shell $(CXX) -dumpversion)
66
ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # >= 4.10
7-
CXXFLAGS += -std=c++11
7+
NEEDED_CXXFLAGS += -std=c++11
88
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
9-
CXXFLAGS += -std=c++11
9+
NEEDED_CXXFLAGS += -std=c++11
1010
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
11-
CXXFLAGS += -std=c++0x
11+
NEEDED_CXXFLAGS += -std=c++0x
1212
else ifeq ($(shell expr match $(CXX) 'clang'),5)
13-
CXXFLAGS += -std=c++11
13+
NEEDED_CXXFLAGS += -std=c++11
1414
else # not supported
1515
$(error Compiler too old)
1616
endif
@@ -34,10 +34,8 @@ IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(GREP) -c "64")
3434
ifeq ($(USE_AESNI),yes)
3535
ifeq ($(IS_64),1)
3636
#check if AES-NI is supported by CPU
37-
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
38-
CXXFLAGS += -maes -DAESNI
39-
else
40-
$(warning "AESNI support enabled requested but not supported by this CPU")
37+
ifneq ($(shell grep -c aes /proc/cpuinfo),0)
38+
CPU_FLAGS = -maes -DAESNI
4139
endif
4240
endif
4341
endif

0 commit comments

Comments
 (0)