2015-11-27 15:56:05 +03:00
|
|
|
# set defaults instead redefine
|
2020-11-15 01:31:20 +03:00
|
|
|
CXXFLAGS ?= ${CXX_DEBUG} -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-psabi
|
2018-06-29 02:27:19 +03:00
|
|
|
LDFLAGS ?= ${LD_DEBUG}
|
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
|
2018-06-29 02:27:19 +03:00
|
|
|
## custom FDLAGS to work at build-time.
|
2014-12-17 23:46:19 +03:00
|
|
|
|
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)
|
2018-01-06 06:48:51 +03:00
|
|
|
NEEDED_CXXFLAGS += -std=c++11
|
2015-05-07 06:40:19 +03:00
|
|
|
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
|
2020-09-27 02:32:19 +03:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "4\.[8-9]"),3) # gcc 4.8 - 4.9
|
2015-11-27 14:42:44 +03:00
|
|
|
NEEDED_CXXFLAGS += -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
|
2020-02-28 22:03:08 +03:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "[5-6]"),1) # gcc 5 - 6
|
2017-11-04 14:52:41 +03:00
|
|
|
NEEDED_CXXFLAGS += -std=c++11
|
2018-09-06 18:19:10 +03:00
|
|
|
LDLIBS = -latomic
|
2020-05-14 22:45:25 +03:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "[1,7-9]"),1) # gcc >= 7
|
2020-02-28 22:03:08 +03:00
|
|
|
NEEDED_CXXFLAGS += -std=c++17
|
|
|
|
LDLIBS = -latomic
|
2014-09-24 03:56:29 +04:00
|
|
|
else # not supported
|
2018-01-05 13:37:32 +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)
|
2016-08-21 03:00:00 +03:00
|
|
|
# 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
|
2020-11-23 01:44:21 +03:00
|
|
|
LIBDIR := /usr/lib/$(SYS)
|
2018-09-06 18:19:10 +03: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
|
2020-11-23 01:44:21 +03:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
|
|
|
LDLIBS += $(LIBDIR)/libminiupnpc.a
|
|
|
|
endif
|
|
|
|
LDLIBS += -lpthread -ldl
|
2014-11-07 17:49:16 +03:00
|
|
|
else
|
2018-09-06 18:19:10 +03:00
|
|
|
LDLIBS += -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
2020-11-23 01:44:21 +03:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
|
|
|
LDLIBS += -lminiupnpc
|
|
|
|
endif
|
2014-11-07 17:49:16 +03:00
|
|
|
endif
|
2014-07-16 20:59:17 +04:00
|
|
|
|
2016-12-01 20:17:28 +03:00
|
|
|
# UPNP Support (miniupnpc 1.5 and higher)
|
2016-06-27 16:00:00 +03:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
2020-11-15 01:31:20 +03:00
|
|
|
NEEDED_CXXFLAGS += -DUSE_UPNP
|
2015-01-03 23:38:48 +03:00
|
|
|
endif
|
|
|
|
|
2014-10-31 20:45:58 +03:00
|
|
|
ifeq ($(USE_AESNI),yes)
|
2020-12-01 03:55:41 +03:00
|
|
|
ifneq (, $(findstring i386, $(SYS))$(findstring i686, $(SYS))$(findstring x86_64, $(SYS))) # only x86-based CPU supports that
|
2020-11-15 01:31:20 +03:00
|
|
|
NEEDED_CXXFLAGS += -D__AES__ -maes
|
2016-12-08 20:59:19 +03:00
|
|
|
endif
|
2016-12-18 16:20:53 +03:00
|
|
|
endif
|
2022-03-22 16:24:19 +03:00
|
|
|
|
|
|
|
install: all
|
2022-04-02 23:16:39 +03:00
|
|
|
install -d ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/i2pd ${PREFIX}/etc/i2pd/tunnels.conf.d ${PREFIX}/usr ${PREFIX}/usr/share ${PREFIX}/usr/share/doc/i2pd ${PREFIX}/usr/share/i2pd ${PREFIX}/usr/share/man ${PREFIX}/usr/share/man/man1 ${PREFIX}/var/lib ${PREFIX}/var/lib/i2pd
|
2022-03-22 16:24:19 +03:00
|
|
|
install -m 755 ${I2PD} ${PREFIX}/bin/
|
|
|
|
install -m 644 contrib/i2pd.conf contrib/subscriptions.txt contrib/tunnels.conf ${PREFIX}/etc/i2pd
|
2022-04-02 23:16:39 +03:00
|
|
|
@cp -R contrib/certificates ${PREFIX}/usr/share/i2pd/
|
|
|
|
install -m 644 ChangeLog LICENSE README.md contrib/i2pd.conf contrib/subscriptions.txt contrib/tunnels.conf ${PREFIX}/usr/share/doc/i2pd
|
|
|
|
@gzip -kf debian/i2pd.1 && install debian/i2pd.1.gz ${PREFIX}/usr/share/man/man1
|
|
|
|
@ln -sf ${PREFIX}/usr/share/i2pd/certificates ${PREFIX}/var/lib/i2pd/
|
2022-03-22 16:24:19 +03:00
|
|
|
@ln -sf ${PREFIX}/etc/i2pd/tunnels.conf.d ${PREFIX}/var/lib/i2pd/tunnels.d
|
|
|
|
@ln -sf ${PREFIX}/etc/i2pd/i2pd.conf ${PREFIX}/var/lib/i2pd/i2pd.conf
|
|
|
|
@ln -sf ${PREFIX}/etc/i2pd/subscriptions.txt ${PREFIX}/var/lib/i2pd/subscriptions.txt
|
|
|
|
@ln -sf ${PREFIX}/etc/i2pd/tunnels.conf ${PREFIX}/var/lib/i2pd/tunnels.conf
|