2018-05-16 16:41:20 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
|
2018-06-07 16:22:49 +00:00
|
|
|
REPO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
|
2019-11-26 11:52:55 +00:00
|
|
|
|
2019-12-03 18:41:20 +00:00
|
|
|
NO_GIT := $(shell test -e $(REPO)/.git/ || echo 1)
|
|
|
|
ifeq ($(NO_GIT),1)
|
|
|
|
all: release
|
|
|
|
else
|
|
|
|
GIT_BRANCH ?= $(shell test -e $(REPO)/.git/ && git rev-parse --abbrev-ref HEAD)
|
2019-11-26 11:52:55 +00:00
|
|
|
ifeq ($(GIT_BRANCH),master)
|
|
|
|
all: release
|
|
|
|
else
|
|
|
|
all: test
|
|
|
|
endif
|
2019-12-03 18:41:20 +00:00
|
|
|
endif
|
2019-11-26 11:52:55 +00:00
|
|
|
|
2019-07-24 15:25:40 +00:00
|
|
|
BUILD_ROOT = $(REPO)/build
|
|
|
|
|
2019-05-04 10:59:59 +00:00
|
|
|
DESTDIR ?=
|
2018-09-15 11:37:46 +00:00
|
|
|
|
2018-11-03 13:19:18 +00:00
|
|
|
CC ?= cc
|
2018-06-28 15:10:25 +00:00
|
|
|
CXX ?= c++
|
2018-06-07 16:22:49 +00:00
|
|
|
|
2019-04-28 15:57:41 +00:00
|
|
|
BUILD_TYPE ?= Debug
|
|
|
|
|
2019-08-26 23:10:48 +00:00
|
|
|
PYTHON ?= python
|
|
|
|
PYTHON3 ?= python3
|
2019-01-21 16:57:12 +00:00
|
|
|
|
2020-04-07 18:12:54 +00:00
|
|
|
FORMAT ?= clang-format-9
|
2019-10-28 14:21:57 +00:00
|
|
|
|
2018-12-04 16:16:43 +00:00
|
|
|
SETCAP ?= which setcap && setcap cap_net_admin,cap_net_bind_service=+eip
|
2018-10-28 14:28:13 +00:00
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
SHADOW_ROOT ?= $(HOME)/.shadow
|
|
|
|
SHADOW_BIN=$(SHADOW_ROOT)/bin/shadow
|
2018-06-07 17:36:17 +00:00
|
|
|
SHADOW_CONFIG=$(REPO)/shadow.config.xml
|
2019-03-07 22:53:36 +00:00
|
|
|
SHADOW_PLUGIN=$(BUILD_ROOT)/libshadow-plugin-lokinet-shared.so
|
2018-06-07 17:36:17 +00:00
|
|
|
SHADOW_LOG=$(REPO)/shadow.log.txt
|
2018-06-06 17:02:57 +00:00
|
|
|
|
2018-08-12 17:22:29 +00:00
|
|
|
SHADOW_SRC ?= $(HOME)/local/shadow
|
2019-03-07 22:53:36 +00:00
|
|
|
SHADOW_PARSE ?= $(PYTHON) $(SHADOW_SRC)/src/tools/parse-shadow.py - -m 0 --packet-data
|
|
|
|
SHADOW_PLOT ?= $(PYTHON) $(SHADOW_SRC)/src/tools/plot-shadow.py -d $(REPO) LokiNET -c $(SHADOW_CONFIG) -r 10000 -e '.*'
|
2019-03-11 13:01:43 +00:00
|
|
|
SHADOW_OPTS ?=
|
2018-07-20 04:50:28 +00:00
|
|
|
|
2019-07-24 15:25:40 +00:00
|
|
|
LIBUV_VERSION ?= v1.30.1
|
|
|
|
LIBUV_PREFIX = $(BUILD_ROOT)/libuv
|
|
|
|
|
2019-12-26 13:01:29 +00:00
|
|
|
LIBCURL_PREFIX = $(BUILD_ROOT)/curl
|
2019-12-26 18:06:30 +00:00
|
|
|
LIBCURL_VERSION = 7.67.0
|
|
|
|
LIBCURL_URL = https://github.com/curl/curl/releases/download/curl-7_67_0/curl-7.67.0.tar.xz
|
|
|
|
LIBCURL_SHA256 = f5d2e7320379338c3952dcc7566a140abb49edb575f9f99272455785c40e536c
|
2019-12-26 13:01:29 +00:00
|
|
|
|
2018-07-20 04:50:28 +00:00
|
|
|
TESTNET_ROOT=/tmp/lokinet_testnet_tmp
|
2018-06-07 16:22:49 +00:00
|
|
|
TESTNET_CONF=$(TESTNET_ROOT)/supervisor.conf
|
|
|
|
TESTNET_LOG=$(TESTNET_ROOT)/testnet.log
|
|
|
|
|
2020-02-02 16:31:01 +00:00
|
|
|
TESTNET_VENV=$(TESTNET_ROOT)/v
|
2018-08-12 17:22:29 +00:00
|
|
|
TESTNET_EXE=$(REPO)/lokinet-testnet
|
2018-07-12 13:43:37 +00:00
|
|
|
TESTNET_CLIENTS ?= 50
|
|
|
|
TESTNET_SERVERS ?= 50
|
|
|
|
TESTNET_DEBUG ?= 0
|
2019-02-07 13:20:03 +00:00
|
|
|
TESTNET_IFNAME ?= lo
|
|
|
|
TESTNET_BASEPORT ?= 1900
|
|
|
|
TESTNET_IP ?= 127.0.0.1
|
|
|
|
TESTNET_NETID ?= loopback
|
2018-07-12 13:43:37 +00:00
|
|
|
|
2018-11-06 13:03:10 +00:00
|
|
|
ANDROID_NDK ?= $(HOME)/Android/Ndk
|
|
|
|
ANDROID_SDK ?= $(HOME)/Android/Sdk
|
2018-11-06 13:14:14 +00:00
|
|
|
ANDROID_ABI ?= armeabi-v7a
|
2019-04-08 14:27:55 +00:00
|
|
|
ANDROID_API_LEVEL ?= 24
|
2018-11-06 13:03:10 +00:00
|
|
|
|
2018-11-06 14:27:25 +00:00
|
|
|
ANDROID_DIR=$(REPO)/android
|
|
|
|
JNI_DIR=$(ANDROID_DIR)/jni
|
|
|
|
ANDROID_MK=$(JNI_DIR)/Android.mk
|
|
|
|
ANDROID_PROPS=$(ANDROID_DIR)/gradle.properties
|
|
|
|
ANDROID_LOCAL_PROPS=$(ANDROID_DIR)/local.properties
|
|
|
|
|
|
|
|
GRADLE ?= gradle
|
|
|
|
JAVA_HOME ?= /usr/lib/jvm/default-java
|
|
|
|
|
2019-07-16 23:52:05 +00:00
|
|
|
TOOLCHAIN ?=
|
2019-07-16 13:41:43 +00:00
|
|
|
|
2020-03-12 16:22:33 +00:00
|
|
|
# 64 for 64bit windows, 32 for 32bit windows
|
|
|
|
# defaults to 64 bit for now
|
|
|
|
WINDOWS_ARCH ?= 64
|
2019-01-09 14:22:35 +00:00
|
|
|
# native avx2 code
|
2018-11-26 13:54:53 +00:00
|
|
|
AVX2 ?= OFF
|
2019-09-18 20:19:13 +00:00
|
|
|
# statically link everything
|
2018-11-08 12:31:50 +00:00
|
|
|
STATIC_LINK ?= OFF
|
2019-09-18 20:19:13 +00:00
|
|
|
# statically link dependencies
|
|
|
|
STATIC ?= OFF
|
2019-01-09 14:22:35 +00:00
|
|
|
# enable network namespace isolation
|
2018-11-19 13:39:35 +00:00
|
|
|
NETNS ?= OFF
|
2019-07-16 23:52:05 +00:00
|
|
|
# enable shell hooks callbacks
|
2019-07-12 13:06:59 +00:00
|
|
|
SHELL_HOOKS ?= OFF
|
2019-01-09 14:22:35 +00:00
|
|
|
# cross compile?
|
2018-11-21 21:52:35 +00:00
|
|
|
CROSS ?= OFF
|
2019-01-09 14:22:35 +00:00
|
|
|
# build liblokinet-shared.so
|
2019-02-26 15:09:37 +00:00
|
|
|
SHARED_LIB ?= OFF
|
2019-01-12 01:19:24 +00:00
|
|
|
# enable generating coverage
|
2019-01-13 01:41:25 +00:00
|
|
|
COVERAGE ?= OFF
|
2020-02-02 20:34:51 +00:00
|
|
|
# allow downloading libsodium if >= 1.0.18 not installed
|
2019-12-17 00:50:02 +00:00
|
|
|
DOWNLOAD_SODIUM ?= OFF
|
2019-10-01 14:51:28 +00:00
|
|
|
|
2019-01-13 01:41:25 +00:00
|
|
|
COVERAGE_OUTDIR ?= "$(TMPDIR)/lokinet-coverage"
|
2019-10-01 14:51:28 +00:00
|
|
|
|
2019-09-03 15:56:56 +00:00
|
|
|
# tracy profiler
|
|
|
|
TRACY_ROOT ?=
|
2019-09-22 14:32:03 +00:00
|
|
|
# enable sanitizer
|
|
|
|
XSAN ?= False
|
2020-02-27 19:43:16 +00:00
|
|
|
# lokinet hive build
|
|
|
|
HIVE ?= OFF
|
2020-02-27 22:10:02 +00:00
|
|
|
# compile unittests
|
|
|
|
TESTS ?= ON
|
|
|
|
|
2019-02-07 14:12:11 +00:00
|
|
|
|
2019-01-09 14:22:35 +00:00
|
|
|
# cmake generator type
|
2018-11-09 13:12:20 +00:00
|
|
|
CMAKE_GEN ?= Unix Makefiles
|
2018-10-27 12:41:04 +00:00
|
|
|
|
2019-02-07 14:12:11 +00:00
|
|
|
|
|
|
|
ifdef NINJA
|
2019-07-22 22:20:17 +00:00
|
|
|
MAKE = $(NINJA)
|
2019-02-07 14:12:11 +00:00
|
|
|
CMAKE_GEN = Ninja
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2018-10-23 11:29:37 +00:00
|
|
|
|
2018-10-27 18:26:08 +00:00
|
|
|
SCAN_BUILD ?= scan-build
|
2019-01-09 14:22:35 +00:00
|
|
|
|
2019-03-30 11:44:43 +00:00
|
|
|
UNAME = $(shell which uname)
|
|
|
|
|
2020-02-27 22:10:02 +00:00
|
|
|
COMMON_CMAKE_OPTIONS = -DSTATIC_LINK_RUNTIME=$(STATIC_LINK) -DUSE_NETNS=$(NETNS) -DUSE_AVX2=$(AVX2) -DWITH_SHARED=$(SHARED_LIB) -DDOWNLOAD_SODIUM=$(DOWNLOAD_SODIUM) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DXSAN=$(XSAN) -DWITH_HIVE=$(HIVE) -DWITH_TESTS=$(TESTS)
|
2019-12-17 00:50:02 +00:00
|
|
|
|
2019-03-30 11:44:43 +00:00
|
|
|
ifeq ($(shell $(UNAME)),SunOS)
|
2019-12-17 00:50:02 +00:00
|
|
|
CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
|
|
|
CONFIG_CMD_WINDOWS = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=ON -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
2019-03-25 07:57:15 +00:00
|
|
|
|
2019-12-17 00:50:02 +00:00
|
|
|
ANALYZE_CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "$(SCAN_BUILD) cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
2019-07-28 23:31:07 +00:00
|
|
|
|
2019-12-17 00:50:02 +00:00
|
|
|
COVERAGE_CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DWITH_COVERAGE=yes $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
2019-03-25 07:57:15 +00:00
|
|
|
else
|
2019-12-17 00:50:02 +00:00
|
|
|
CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DUSE_SHELLHOOKS=$(SHELL_HOOKS) -DTRACY_ROOT=$(TRACY_ROOT) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
2020-03-12 16:22:33 +00:00
|
|
|
CONFIG_CMD_WINDOWS = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=ON -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS)")
|
2019-07-28 23:31:07 +00:00
|
|
|
|
2020-02-24 17:53:16 +00:00
|
|
|
ANALYZE_CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "$(SCAN_BUILD) cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
2018-10-27 18:26:08 +00:00
|
|
|
|
2020-02-24 17:53:16 +00:00
|
|
|
COVERAGE_CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DWITH_COVERAGE=yes $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
|
2019-03-25 07:57:15 +00:00
|
|
|
endif
|
2019-01-13 01:41:25 +00:00
|
|
|
|
2018-10-23 11:29:37 +00:00
|
|
|
TARGETS = $(REPO)/lokinet
|
|
|
|
SIGS = $(TARGETS:=.sig)
|
2019-10-05 16:48:58 +00:00
|
|
|
EXE = $(BUILD_ROOT)/daemon/lokinet
|
2019-02-11 00:02:20 +00:00
|
|
|
TEST_EXE = $(BUILD_ROOT)/test/testAll
|
2018-10-24 18:02:42 +00:00
|
|
|
ABYSS_EXE = $(BUILD_ROOT)/abyss-main
|
2018-10-23 11:29:37 +00:00
|
|
|
|
2018-09-28 14:29:34 +00:00
|
|
|
LINT_FILES = $(wildcard llarp/*.cpp)
|
|
|
|
|
|
|
|
LINT_CHECK = $(LINT_FILES:.cpp=.cpp-check)
|
|
|
|
|
2019-07-24 15:25:40 +00:00
|
|
|
clean: android-clean
|
2018-11-13 13:37:35 +00:00
|
|
|
rm -f $(TARGETS)
|
2018-10-23 11:29:37 +00:00
|
|
|
rm -rf $(BUILD_ROOT)
|
2018-06-06 17:02:57 +00:00
|
|
|
rm -f $(SHADOW_PLUGIN) $(SHADOW_CONFIG)
|
2018-05-28 13:49:44 +00:00
|
|
|
rm -f *.sig
|
2018-08-02 21:26:14 +00:00
|
|
|
rm -f *.a *.so
|
2018-05-16 15:59:24 +00:00
|
|
|
|
2019-07-24 15:25:40 +00:00
|
|
|
android-clean:
|
|
|
|
rm -rf $(ANDROID_DIR)/.externalNativeBuild
|
|
|
|
|
2018-10-23 11:29:37 +00:00
|
|
|
debug-configure:
|
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2019-07-16 13:41:43 +00:00
|
|
|
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)') || (test x$(TOOLCHAIN) != x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN) )
|
|
|
|
|
2018-05-16 15:59:24 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
release-configure: clean
|
2018-11-03 13:19:18 +00:00
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2020-01-02 17:25:30 +00:00
|
|
|
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
|
2018-05-28 13:49:44 +00:00
|
|
|
|
2018-05-27 16:45:04 +00:00
|
|
|
debug: debug-configure
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT)
|
2019-02-07 14:12:11 +00:00
|
|
|
cp $(EXE) $(REPO)/lokinet
|
2019-01-08 22:30:21 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
release-compile: release-configure
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT)
|
2019-05-04 14:25:15 +00:00
|
|
|
strip $(EXE)
|
2018-05-28 13:49:44 +00:00
|
|
|
|
|
|
|
$(TARGETS): release-compile
|
|
|
|
|
2019-11-26 11:52:55 +00:00
|
|
|
release: $(TARGETS)
|
2020-02-10 17:12:20 +00:00
|
|
|
make -C '$(BUILD_ROOT)' check
|
2018-05-28 13:49:44 +00:00
|
|
|
|
2018-06-06 13:17:03 +00:00
|
|
|
shadow-configure: clean
|
2018-11-08 15:15:02 +00:00
|
|
|
mkdir -p $(BUILD_ROOT)
|
2019-04-28 15:57:41 +00:00
|
|
|
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSHADOW=ON
|
2018-06-06 13:17:03 +00:00
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
shadow-build: shadow-configure
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT)
|
2018-06-06 13:17:03 +00:00
|
|
|
|
2018-07-20 04:50:28 +00:00
|
|
|
shadow-run: shadow-build
|
2019-08-26 23:10:48 +00:00
|
|
|
$(PYTHON3) $(REPO)/contrib/shadow/genconf.py $(SHADOW_CONFIG)
|
2019-03-11 13:01:43 +00:00
|
|
|
cp $(SHADOW_PLUGIN) $(REPO)/libshadow-plugin-lokinet.so
|
|
|
|
$(SHADOW_BIN) $(SHADOW_OPTS) $(SHADOW_CONFIG) | $(SHADOW_PARSE)
|
2018-07-20 04:50:28 +00:00
|
|
|
|
|
|
|
shadow-plot: shadow-run
|
|
|
|
$(SHADOW_PLOT)
|
|
|
|
|
|
|
|
shadow: shadow-plot
|
2018-06-07 16:22:49 +00:00
|
|
|
|
2018-08-02 00:48:43 +00:00
|
|
|
testnet-clean: clean
|
|
|
|
rm -rf $(TESTNET_ROOT)
|
|
|
|
|
|
|
|
testnet-configure: testnet-clean
|
2018-11-08 15:15:02 +00:00
|
|
|
mkdir -p $(BUILD_ROOT)
|
2019-04-28 15:57:41 +00:00
|
|
|
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=1
|
2018-06-07 16:22:49 +00:00
|
|
|
|
|
|
|
testnet-build: testnet-configure
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT)
|
2018-06-07 16:22:49 +00:00
|
|
|
|
2020-02-02 16:31:01 +00:00
|
|
|
$(TESTNET_VENV):
|
2020-02-02 16:57:59 +00:00
|
|
|
$(PYTHON3) -m venv $(TESTNET_VENV) --system-site-packages
|
2020-02-02 16:31:01 +00:00
|
|
|
$(TESTNET_VENV)/bin/pip install -r $(REPO)/contrib/testnet/requirements.txt
|
|
|
|
|
|
|
|
testnet: $(TESTNET_VENV)
|
2018-08-12 17:22:29 +00:00
|
|
|
cp $(EXE) $(TESTNET_EXE)
|
2018-06-07 16:22:49 +00:00
|
|
|
mkdir -p $(TESTNET_ROOT)
|
2020-02-02 16:31:01 +00:00
|
|
|
$(PYTHON3) $(REPO)/contrib/testnet/genconf.py --bin=$(TESTNET_EXE) --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF) --ifname=$(TESTNET_IFNAME) --baseport=$(TESTNET_BASEPORT) --ip=$(TESTNET_IP) --netid=$(TESTNET_NETID) --lokid='$(TESTNET_VENV)/bin/python $(REPO)/contrib/testnet/lokid.py'
|
2018-07-12 13:43:37 +00:00
|
|
|
LLARP_DEBUG=$(TESTNET_DEBUG) supervisord -n -d $(TESTNET_ROOT) -l $(TESTNET_LOG) -c $(TESTNET_CONF)
|
2018-06-06 13:17:03 +00:00
|
|
|
|
2020-02-22 20:07:43 +00:00
|
|
|
gtest: debug
|
|
|
|
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) rungtest || test x$(CROSS) = xON
|
2018-11-13 13:37:35 +00:00
|
|
|
|
2020-02-22 20:07:43 +00:00
|
|
|
catch: debug
|
|
|
|
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) catch || test x$(CROSS) = xON
|
2018-06-14 14:04:42 +00:00
|
|
|
|
2020-02-22 20:07:43 +00:00
|
|
|
check: debug
|
|
|
|
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || test x$(CROSS) = xON
|
|
|
|
|
|
|
|
test: check
|
2020-02-10 17:12:20 +00:00
|
|
|
|
2019-12-26 13:01:29 +00:00
|
|
|
static-configure: $(LIBUV_PREFIX) $(LIBCURL_PREFIX)
|
2020-03-18 04:54:38 +00:00
|
|
|
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' -DNATIVE_BUILD=OFF ) || (test x$(TOOLCHAIN) != x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN) -DNATIVE_BUILD=OFF )
|
2019-12-26 13:01:29 +00:00
|
|
|
|
|
|
|
static: static-configure
|
|
|
|
$(MAKE) -C '$(BUILD_ROOT)'
|
|
|
|
cp $(EXE) $(REPO)/lokinet-static
|
2019-07-24 15:25:40 +00:00
|
|
|
|
2019-12-26 13:01:29 +00:00
|
|
|
$(LIBCURL_PREFIX):
|
2019-12-26 18:06:30 +00:00
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
|
|
|
wget '$(LIBCURL_URL)' -O '$(BUILD_ROOT)/curl.tar.xz'
|
|
|
|
bash -c 'sha256sum -c <<<"$(LIBCURL_SHA256) $(BUILD_ROOT)/curl.tar.xz"'
|
|
|
|
tar -xJf '$(BUILD_ROOT)/curl.tar.xz' -C '$(BUILD_ROOT)'
|
|
|
|
mv '$(BUILD_ROOT)/curl-$(LIBCURL_VERSION)' '$(LIBCURL_PREFIX)'
|
2019-07-24 15:25:40 +00:00
|
|
|
|
|
|
|
$(LIBUV_PREFIX):
|
|
|
|
mkdir -p $(BUILD_ROOT)
|
|
|
|
git clone -b "$(LIBUV_VERSION)" https://github.com/libuv/libuv "$(LIBUV_PREFIX)"
|
|
|
|
|
2019-09-30 08:59:34 +00:00
|
|
|
ios:
|
|
|
|
cmake -S ui-ios -B build -G Xcode -DCMAKE_TOOLCHAIN_FILE=$(shell pwd)/ui-ios/ios-toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=12.2 -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO -DCMAKE_IOS_INSTALL_COMBINED=YES
|
|
|
|
cmake --build build
|
|
|
|
|
2019-07-24 15:25:40 +00:00
|
|
|
android-gradle-prepare: $(LIBUV_PREFIX)
|
2018-11-06 14:27:25 +00:00
|
|
|
rm -f $(ANDROID_PROPS)
|
|
|
|
rm -f $(ANDROID_LOCAL_PROPS)
|
|
|
|
echo "#auto generated don't modify kthnx" >> $(ANDROID_PROPS)
|
2019-07-24 15:25:40 +00:00
|
|
|
echo "libuvsrc=$(LIBUV_PREFIX)" >> $(ANDROID_PROPS)
|
2018-11-06 14:27:25 +00:00
|
|
|
echo "lokinetCMake=$(REPO)/CMakeLists.txt" >> $(ANDROID_PROPS)
|
|
|
|
echo "org.gradle.parallel=true" >> $(ANDROID_PROPS)
|
2019-04-08 15:54:19 +00:00
|
|
|
echo "org.gradle.jvmargs=-Xmx1536M" >> $(ANDROID_PROPS)
|
2018-11-06 14:27:25 +00:00
|
|
|
echo "#auto generated don't modify kthnx" >> $(ANDROID_LOCAL_PROPS)
|
|
|
|
echo "sdk.dir=$(ANDROID_SDK)" >> $(ANDROID_LOCAL_PROPS)
|
|
|
|
echo "ndk.dir=$(ANDROID_NDK)" >> $(ANDROID_LOCAL_PROPS)
|
|
|
|
|
|
|
|
android-gradle: android-gradle-prepare
|
2018-11-07 12:23:06 +00:00
|
|
|
cd $(ANDROID_DIR) && JAVA_HOME=$(JAVA_HOME) $(GRADLE) clean assemble
|
2018-11-18 22:40:35 +00:00
|
|
|
|
2018-11-06 14:27:25 +00:00
|
|
|
android: android-gradle
|
2018-11-26 22:46:22 +00:00
|
|
|
cp -f $(ANDROID_DIR)/build/outputs/apk/*.apk $(REPO)
|
2018-11-06 14:06:09 +00:00
|
|
|
|
2019-12-11 21:05:40 +00:00
|
|
|
windows-debug-configure: $(LIBUV_PREFIX)
|
2019-04-10 16:04:45 +00:00
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2020-03-12 16:22:33 +00:00
|
|
|
$(CONFIG_CMD_WINDOWS) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw$(WINDOWS_ARCH).cmake' -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT=$'(LIBUV_PREFIX)' '$(REPO)'
|
2019-04-10 16:04:45 +00:00
|
|
|
|
|
|
|
windows-debug: windows-debug-configure
|
|
|
|
$(MAKE) -C '$(BUILD_ROOT)'
|
2019-10-30 20:44:27 +00:00
|
|
|
cp '$(BUILD_ROOT)/daemon/lokinet.exe' '$(REPO)/lokinet.exe'
|
2019-04-10 16:04:45 +00:00
|
|
|
|
2019-12-11 21:05:40 +00:00
|
|
|
windows-release-configure: $(LIBUV_PREFIX)
|
2018-11-09 12:49:29 +00:00
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2020-04-18 19:58:41 +00:00
|
|
|
$(CONFIG_CMD_WINDOWS) -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw$(WINDOWS_ARCH).cmake' -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DWITH_TESTS=OFF '$(REPO)'
|
2018-11-09 12:49:29 +00:00
|
|
|
|
2019-03-11 13:01:43 +00:00
|
|
|
windows-release: windows-release-configure
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C '$(BUILD_ROOT)'
|
2020-01-10 19:59:45 +00:00
|
|
|
cd '$(BUILD_ROOT)' && cpack -D CPACK_MONOLITHIC_INSTALL=1 -G NSIS ..
|
2018-11-09 12:49:29 +00:00
|
|
|
|
2020-01-10 22:43:29 +00:00
|
|
|
windows: windows-release
|
2019-03-11 13:01:43 +00:00
|
|
|
|
2020-04-03 14:25:24 +00:00
|
|
|
mac-release-configure: $(LIBUV_PREFIX)
|
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2020-04-03 17:04:41 +00:00
|
|
|
$(CONFIG_CMD) -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DWITH_TESTS=OFF '$(REPO)'
|
2020-04-03 14:25:24 +00:00
|
|
|
|
|
|
|
mac-release: mac-release-configure
|
2020-04-06 14:06:36 +00:00
|
|
|
$(MAKE) -C '$(BUILD_ROOT)'
|
2020-04-02 15:25:32 +00:00
|
|
|
|
|
|
|
mac: mac-release
|
2020-04-06 14:06:36 +00:00
|
|
|
$(MAKE) -C '$(BUILD_ROOT)' package
|
2020-04-02 15:25:32 +00:00
|
|
|
|
2018-10-24 18:02:42 +00:00
|
|
|
abyss: debug
|
|
|
|
$(ABYSS_EXE)
|
|
|
|
|
2018-05-21 14:28:15 +00:00
|
|
|
format:
|
2020-02-26 21:54:16 +00:00
|
|
|
$(FORMAT) -i $$(find jni daemon llarp include libabyss pybind | grep -E '\.[h,c](pp)?$$')
|
2018-09-15 11:37:46 +00:00
|
|
|
|
2019-08-07 23:34:16 +00:00
|
|
|
format-verify: format
|
2019-10-28 14:21:57 +00:00
|
|
|
(type $(FORMAT))
|
|
|
|
$(FORMAT) --version
|
2019-08-12 21:03:38 +00:00
|
|
|
git diff --quiet || (echo 'Please run make format!!' && git --no-pager diff ; exit 1)
|
2019-08-07 23:34:16 +00:00
|
|
|
|
2018-11-05 11:31:43 +00:00
|
|
|
analyze-config: clean
|
2018-10-27 19:03:23 +00:00
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2018-11-05 11:31:43 +00:00
|
|
|
$(ANALYZE_CONFIG_CMD)
|
|
|
|
|
|
|
|
analyze: analyze-config
|
2019-02-08 13:12:07 +00:00
|
|
|
$(SCAN_BUILD) $(MAKE) -C $(BUILD_ROOT)
|
2018-10-27 18:26:08 +00:00
|
|
|
|
2019-01-13 01:41:25 +00:00
|
|
|
coverage-config: clean
|
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
|
|
|
$(COVERAGE_CONFIG_CMD)
|
|
|
|
|
|
|
|
coverage: coverage-config
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT)
|
2020-02-22 20:07:43 +00:00
|
|
|
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || true # continue even if tests fail
|
2019-01-13 01:41:25 +00:00
|
|
|
mkdir -p "$(COVERAGE_OUTDIR)"
|
|
|
|
ifeq ($(CLANG),OFF)
|
|
|
|
gcovr -r . --branches --html --html-details -o "$(COVERAGE_OUTDIR)/lokinet.html"
|
|
|
|
else
|
|
|
|
llvm-profdata merge default.profraw -output $(BUILD_ROOT)/profdata
|
|
|
|
llvm-cov show -format=html -output-dir="$(COVERAGE_OUTDIR)" -instr-profile "$(BUILD_ROOT)/profdata" "$(BUILD_ROOT)/testAll" $(shell find ./llarp -type f)
|
|
|
|
endif
|
|
|
|
|
2018-09-28 14:29:34 +00:00
|
|
|
lint: $(LINT_CHECK)
|
|
|
|
|
|
|
|
%.cpp-check: %.cpp
|
2018-11-05 11:31:43 +00:00
|
|
|
clang-tidy $^ -- -I$(REPO)/include -I$(REPO)/crypto/include -I$(REPO)/llarp -I$(REPO)/vendor/cppbackport-master/lib
|
2018-09-28 14:29:34 +00:00
|
|
|
|
2019-01-21 16:57:12 +00:00
|
|
|
docker-kubernetes:
|
|
|
|
docker build -f docker/loki-svc-kubernetes.Dockerfile .
|
|
|
|
|
|
|
|
install-pylokinet:
|
2019-08-26 23:10:48 +00:00
|
|
|
cd $(REPO)/contrib/py/pylokinet && $(PYTHON3) setup.py install
|
2019-01-21 16:57:12 +00:00
|
|
|
|
|
|
|
kubernetes-install: install install-pylokinet
|
2019-01-21 15:45:18 +00:00
|
|
|
|
2018-11-02 20:51:02 +00:00
|
|
|
docker-debian:
|
|
|
|
docker build -f docker/debian.Dockerfile .
|
|
|
|
|
|
|
|
docker-fedora:
|
|
|
|
docker build -f docker/fedora.Dockerfile .
|
|
|
|
|
2018-11-13 13:37:35 +00:00
|
|
|
debian-configure:
|
|
|
|
mkdir -p '$(BUILD_ROOT)'
|
2019-05-04 14:25:15 +00:00
|
|
|
$(CONFIG_CMD) -DDEBIAN=ON -DRELEASE_MOTTO="$(shell cat $(REPO)/motto.txt)" -DCMAKE_BUILD_TYPE=Release
|
2018-11-13 13:37:35 +00:00
|
|
|
|
|
|
|
debian: debian-configure
|
2019-02-08 13:12:07 +00:00
|
|
|
$(MAKE) -C '$(BUILD_ROOT)'
|
2019-01-12 01:19:24 +00:00
|
|
|
cp $(EXE) lokinet
|
2018-11-13 13:37:35 +00:00
|
|
|
|
2018-11-13 15:16:14 +00:00
|
|
|
debian-test:
|
2020-02-22 20:07:43 +00:00
|
|
|
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || test x$(CROSS) = xON
|
2018-11-13 15:16:14 +00:00
|
|
|
|
2019-01-12 01:19:24 +00:00
|
|
|
install:
|
2019-05-04 10:59:59 +00:00
|
|
|
DESTDIR=$(DESTDIR) $(MAKE) -C '$(BUILD_ROOT)' install
|
2018-11-13 15:16:14 +00:00
|
|
|
|
2020-03-30 10:25:25 +00:00
|
|
|
doc: debug-configure
|
2020-03-30 12:09:35 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT) clean
|
2020-03-30 10:25:25 +00:00
|
|
|
$(MAKE) -C $(BUILD_ROOT) doc
|
|
|
|
|
2018-12-03 13:29:30 +00:00
|
|
|
.PHONY: debian-install
|