i2pd/Makefile.linux

63 lines
2.2 KiB
Makefile
Raw Normal View History

# set defaults instead redefine
2016-06-01 03:00:00 +03:00
CXXFLAGS ?= -g -Wall -Wextra -Wno-unused-parameter -pedantic
INCFLAGS ?=
2014-09-23 05:44:09 +04:00
2014-12-17 23:46:19 +03: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 06:40:19 +03:00
# detect proper flag for c++11 support by compilers
2014-12-12 11:05:27 +03:00
CXXVER := $(shell $(CXX) -dumpversion)
2015-05-07 06:40:19 +03: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 23:46:19 +03:00
NEEDED_CXXFLAGS += -std=c++11
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
2014-12-17 23:46:19 +03:00
NEEDED_CXXFLAGS += -std=c++0x
2016-05-11 18:57:02 +03:00
else ifeq ($(shell expr match ${CXXVER} "[5-6]\.[0-9]"),3) # gcc >= 5.0
2014-12-17 23:46:19 +03:00
NEEDED_CXXFLAGS += -std=c++11
else # not supported
2014-12-17 23:46:19 +03:00
$(error Compiler too old)
2014-09-23 05:44:09 +04:00
endif
2015-01-13 15:14:52 +03:00
NEEDED_CXXFLAGS += -fPIC
2014-12-12 11:22:03 +03:00
ifeq ($(USE_STATIC),yes)
# NOTE: on glibc you will get this warning:
# Using 'getaddrinfo' in statically linked applications requires at runtime
# the shared libraries from the glibc version used for linking
LIBDIR := /usr/lib
2016-08-27 16:29:18 +03:00
LDLIBS = $(LIBDIR)/libboost_system.a
LDLIBS += $(LIBDIR)/libboost_date_time.a
LDLIBS += $(LIBDIR)/libboost_filesystem.a
LDLIBS += $(LIBDIR)/libboost_program_options.a
LDLIBS += $(LIBDIR)/libssl.a
LDLIBS += $(LIBDIR)/libcrypto.a
LDLIBS += $(LIBDIR)/libz.a
LDLIBS += -lpthread -static-libstdc++ -static-libgcc -lrt -ldl
USE_AESNI := no
else
2016-05-27 03:00:00 +03:00
LDLIBS = -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
endif
# UPNP Support (miniupnpc 1.5 or 1.6)
ifeq ($(USE_UPNP),yes)
2016-06-24 20:15:51 +03:00
LDFLAGS += -lminiupnpc
CXXFLAGS += -DUSE_UPNP
endif
2014-12-12 11:22:03 +03:00
IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(GREP) -c "64")
2014-10-31 20:45:58 +03:00
ifeq ($(USE_AESNI),yes)
2014-10-30 00:11:58 +03:00
ifeq ($(IS_64),1)
#check if AES-NI is supported by CPU
2016-10-26 03:00:00 +03:00
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),0)
CPU_FLAGS = -maes -DAESNI
endif
2014-10-30 00:11:58 +03:00
endif
2014-10-31 20:45:58 +03:00
endif