1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-16 18:59:56 +00:00
i2pd/Makefile.linux

65 lines
2.3 KiB
Makefile
Raw Normal View History

# set defaults instead redefine
CXXFLAGS ?= ${CXX_DEBUG} -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-psabi
LDFLAGS ?= ${LD_DEBUG}
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 FDLAGS to work at build-time.
2014-12-17 20:46:19 +00:00
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)
2018-01-06 11:48:51 +08:00
NEEDED_CXXFLAGS += -std=c++11
2015-05-07 03:40:19 +00:00
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
2020-09-26 19:32:19 -04:00
else ifeq ($(shell expr match ${CXXVER} "4\.[8-9]"),3) # gcc 4.8 - 4.9
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
2020-02-28 14:03:08 -05:00
else ifeq ($(shell expr match ${CXXVER} "[5-6]"),1) # gcc 5 - 6
2017-11-04 07:52:41 -04:00
NEEDED_CXXFLAGS += -std=c++11
2018-09-06 11:19:10 -04:00
LDLIBS = -latomic
2020-05-14 15:45:25 -04:00
else ifeq ($(shell expr match ${CXXVER} "[1,7-9]"),1) # gcc >= 7
2020-02-28 14:03:08 -05:00
NEEDED_CXXFLAGS += -std=c++17
LDLIBS = -latomic
else # not supported
$(error Compiler too old)
2014-09-23 01:44:09 +00:00
endif
2015-01-13 15:14:52 +03:00
NEEDED_CXXFLAGS += -fPIC
2014-12-12 08:22:03 +00: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/$(SYS)
2018-09-06 11:19:10 -04:00
LDLIBS += $(LIBDIR)/libboost_system.a
2017-04-22 04:17:01 +03:00
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
ifeq ($(USE_UPNP),yes)
LDLIBS += $(LIBDIR)/libminiupnpc.a
endif
LDLIBS += -lpthread -ldl
else
2018-09-06 11:19:10 -04:00
LDLIBS += -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
ifeq ($(USE_UPNP),yes)
LDLIBS += -lminiupnpc
endif
endif
2016-12-01 20:17:28 +03:00
# UPNP Support (miniupnpc 1.5 and higher)
ifeq ($(USE_UPNP),yes)
NEEDED_CXXFLAGS += -DUSE_UPNP
endif
2014-10-31 17:45:58 +00:00
ifeq ($(USE_AESNI),yes)
ifeq (, $(findstring arm, $(SYS))$(findstring aarch64, $(SYS))) # no arm and aarch64 in dumpmachine
NEEDED_CXXFLAGS += -D__AES__ -maes
2016-12-08 12:59:19 -05:00
endif
2016-12-18 16:20:53 +03:00
endif