2015-11-27 12:56:05 +00:00
|
|
|
# set defaults instead redefine
|
2020-11-14 22:31:20 +00:00
|
|
|
CXXFLAGS ?= ${CXX_DEBUG} -Wall -Wextra -Wno-unused-parameter -pedantic -Wno-psabi
|
2018-06-28 23:27:19 +00:00
|
|
|
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
|
2018-06-28 23:27:19 +00:00
|
|
|
## custom FDLAGS to work at build-time.
|
2014-12-17 20:46:19 +00:00
|
|
|
|
2024-09-02 14:18:08 +00:00
|
|
|
# detect proper flag for c++17 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)
|
2024-09-02 14:18:08 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++17
|
2024-08-30 21:54:56 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "[8-9]"),1) # gcc 8 - 9
|
2020-02-28 19:03:08 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++17
|
2024-11-23 23:34:33 +00:00
|
|
|
LDLIBS = -lboost_system -lstdc++fs
|
2024-08-30 21:54:56 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "1[0-2]"),2) # gcc 10 - 12
|
2023-01-06 23:20:26 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++17
|
2024-08-28 16:01:19 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "1[3-9]"),2) # gcc 13+
|
2024-08-28 15:34:07 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++20
|
2014-09-23 23:56:29 +00:00
|
|
|
else # not supported
|
2018-01-05 10:37:32 +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)
|
2016-08-21 00:00:00 +00: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-22 22:44:21 +00:00
|
|
|
LIBDIR := /usr/lib/$(SYS)
|
2017-04-22 01:17:01 +00:00
|
|
|
LDLIBS += $(LIBDIR)/libboost_program_options.a
|
|
|
|
LDLIBS += $(LIBDIR)/libssl.a
|
|
|
|
LDLIBS += $(LIBDIR)/libcrypto.a
|
|
|
|
LDLIBS += $(LIBDIR)/libz.a
|
2020-11-22 22:44:21 +00:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
|
|
|
LDLIBS += $(LIBDIR)/libminiupnpc.a
|
|
|
|
endif
|
|
|
|
LDLIBS += -lpthread -ldl
|
2014-11-07 14:49:16 +00:00
|
|
|
else
|
2024-11-23 23:34:33 +00:00
|
|
|
LDLIBS += -lcrypto -lssl -lz -lboost_program_options -lpthread -latomic
|
2020-11-22 22:44:21 +00:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
|
|
|
LDLIBS += -lminiupnpc
|
|
|
|
endif
|
2014-11-07 14:49:16 +00:00
|
|
|
endif
|
2014-07-16 16:59:17 +00:00
|
|
|
|
2016-12-01 17:17:28 +00:00
|
|
|
# UPNP Support (miniupnpc 1.5 and higher)
|
2016-06-27 13:00:00 +00:00
|
|
|
ifeq ($(USE_UPNP),yes)
|
2023-02-26 20:38:23 +00:00
|
|
|
DEFINES += -DUSE_UPNP
|
2015-01-03 20:38:48 +00:00
|
|
|
endif
|
|
|
|
|
2022-03-22 13:24:19 +00:00
|
|
|
install: all
|
2022-06-23 16:55:08 +00:00
|
|
|
install -d ${PREFIX}/bin
|
|
|
|
install -m 755 ${I2PD} ${PREFIX}/bin
|
|
|
|
install -d ${PREFIX}/etc ${PREFIX}/etc/i2pd ${PREFIX}/etc/i2pd/tunnels.conf.d
|
2022-03-22 13:24:19 +00:00
|
|
|
install -m 644 contrib/i2pd.conf contrib/subscriptions.txt contrib/tunnels.conf ${PREFIX}/etc/i2pd
|
2022-06-23 16:55:08 +00:00
|
|
|
install -d ${PREFIX}/share ${PREFIX}/share/doc ${PREFIX}/share/doc/i2pd
|
|
|
|
install -m 644 ChangeLog LICENSE README.md contrib/i2pd.conf contrib/subscriptions.txt contrib/tunnels.conf ${PREFIX}/share/doc/i2pd
|
|
|
|
install -d ${PREFIX}/share/i2pd
|
|
|
|
@cp -R contrib/certificates ${PREFIX}/share/i2pd/
|
|
|
|
install -d ${PREFIX}/share/man ${PREFIX}/share/man/man1
|
|
|
|
@gzip -kf debian/i2pd.1 && install debian/i2pd.1.gz ${PREFIX}/share/man/man1
|
|
|
|
install -d ${PREFIX}/var ${PREFIX}/var/lib ${PREFIX}/var/lib/i2pd
|
|
|
|
@ln -sf ${PREFIX}/share/i2pd/certificates ${PREFIX}/var/lib/i2pd/certificates
|
2022-03-22 13:24:19 +00: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
|