2015-11-27 12:56:05 +00:00
|
|
|
# set defaults instead redefine
|
2016-06-01 00:00:00 +00:00
|
|
|
CXXFLAGS ?= -g -Wall -Wextra -Wno-unused-parameter -pedantic
|
2015-11-27 12:56:05 +00:00
|
|
|
INCFLAGS ?=
|
2014-09-23 01:44:09 +00:00
|
|
|
|
2014-12-17 20:46:19 +00:00
|
|
|
## NOTE: The NEEDED_CXXFLAGS are here so that custom CXXFLAGS can be specified at build time
|
|
|
|
## **without** overwriting the CXXFLAGS which we need in order to build.
|
|
|
|
## For example, when adding 'hardening flags' to the build
|
|
|
|
## (e.g. -fstack-protector-strong -Wformat -Werror=format-security), we do not want to remove
|
|
|
|
## -std=c++11. If you want to remove this variable please do so in a way that allows setting
|
|
|
|
## custom FLAGS to work at build-time.
|
|
|
|
|
2015-05-07 03:40:19 +00:00
|
|
|
# detect proper flag for c++11 support by compilers
|
2014-12-12 08:05:27 +00:00
|
|
|
CXXVER := $(shell $(CXX) -dumpversion)
|
2015-05-07 03:40:19 +00:00
|
|
|
ifeq ($(shell expr match $(CXX) 'clang'),5)
|
|
|
|
NEEDED_CXXFLAGS += -std=c++11
|
|
|
|
else ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # gcc >= 4.10
|
2014-12-17 20:46:19 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++11
|
2014-09-23 23:56:29 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
|
2015-11-27 11:42:44 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
|
2014-09-23 23:56:29 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
|
2014-12-17 20:46:19 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++0x
|
2016-05-11 15:57:02 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "[5-6]\.[0-9]"),3) # gcc >= 5.0
|
2014-12-17 20:46:19 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++11
|
2014-09-23 23:56:29 +00:00
|
|
|
else # not supported
|
2014-12-17 20:46:19 +00:00
|
|
|
$(error Compiler too old)
|
2014-09-23 01:44:09 +00:00
|
|
|
endif
|
|
|
|
|
2015-01-13 12:14:52 +00:00
|
|
|
NEEDED_CXXFLAGS += -fPIC
|
|
|
|
|
2014-12-12 08:22:03 +00:00
|
|
|
ifeq ($(USE_STATIC),yes)
|
2014-12-12 08:10:33 +00:00
|
|
|
LIBDIR := /usr/lib
|
2014-12-12 08:53:17 +00:00
|
|
|
LDLIBS = $(LIBDIR)/libboost_system.a
|
2014-12-12 08:10:33 +00:00
|
|
|
LDLIBS += $(LIBDIR)/libboost_date_time.a
|
|
|
|
LDLIBS += $(LIBDIR)/libboost_filesystem.a
|
|
|
|
LDLIBS += $(LIBDIR)/libboost_program_options.a
|
2015-11-03 14:15:49 +00:00
|
|
|
LDLIBS += $(LIBDIR)/libssl.a
|
2016-06-26 15:17:05 +00:00
|
|
|
LDLIBS += $(LIBDIR)/libcrypto.a
|
2015-11-03 14:15:49 +00:00
|
|
|
LDLIBS += $(LIBDIR)/libz.a
|
2016-06-26 15:17:05 +00:00
|
|
|
LDLIBS += -lpthread -static-libstdc++ -static-libgcc -lrt
|
2014-12-12 08:10:33 +00:00
|
|
|
USE_AESNI := no
|
2014-11-07 14:49:16 +00:00
|
|
|
else
|
2016-05-27 00:00:00 +00:00
|
|
|
LDLIBS = -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
2014-11-07 14:49:16 +00:00
|
|
|
endif
|
2014-07-16 16:59:17 +00:00
|
|
|
|
2015-01-03 20:38:48 +00:00
|
|
|
# UPNP Support (miniupnpc 1.5 or 1.6)
|
2016-06-27 13:00:00 +00:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
2016-06-24 17:15:51 +00:00
|
|
|
LDFLAGS += -lminiupnpc
|
2015-01-03 20:38:48 +00:00
|
|
|
CXXFLAGS += -DUSE_UPNP
|
|
|
|
endif
|
|
|
|
|
2014-12-12 08:22:03 +00:00
|
|
|
IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(GREP) -c "64")
|
2014-10-31 17:45:58 +00:00
|
|
|
ifeq ($(USE_AESNI),yes)
|
2014-10-29 21:11:58 +00:00
|
|
|
ifeq ($(IS_64),1)
|
2014-07-16 16:59:17 +00:00
|
|
|
#check if AES-NI is supported by CPU
|
2014-12-17 20:24:36 +00:00
|
|
|
ifneq ($(shell grep -c aes /proc/cpuinfo),0)
|
|
|
|
CPU_FLAGS = -maes -DAESNI
|
2014-07-16 16:59:17 +00:00
|
|
|
endif
|
2014-10-29 21:11:58 +00:00
|
|
|
endif
|
2014-10-31 17:45:58 +00:00
|
|
|
endif
|