lokinet/Makefile

342 lines
12 KiB
Makefile
Raw Normal View History

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
BUILD_ROOT = $(REPO)/build
DESTDIR ?=
2018-11-03 13:19:18 +00:00
CC ?= cc
2018-06-28 15:10:25 +00:00
CXX ?= c++
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
LIBUV_VERSION ?= v1.30.1
LIBUV_PREFIX = $(BUILD_ROOT)/libuv
2019-12-26 13:01:29 +00:00
LIBCURL_PREFIX = $(BUILD_ROOT)/curl
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
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
TESTNET_CLIENTS ?= 50
TESTNET_SERVERS ?= 50
TESTNET_DEBUG ?= 0
TESTNET_IFNAME ?= lo
TESTNET_BASEPORT ?= 1900
TESTNET_IP ?= 127.0.0.1
TESTNET_NETID ?= loopback
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 ?=
# 64 for 64bit windows, 32 for 32bit windows
# defaults to 64 bit for now
WINDOWS_ARCH ?= 64
# native avx2 code
2018-11-26 13:54:53 +00:00
AVX2 ?= OFF
2019-09-18 20:19:13 +00:00
# statically link dependencies
cmake refactor Refactors many things in cmake to improve and simplify: - don't use variable indirection for target names; target names are *already* a variable of sorts. (e.g. ${UTIL_LIB} is now just lokinet-util). cmake/basic_definitions.cmake is now gone. - fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather than shoving a bunch of flag hacks through link_libraries and add_compile_options. This also now enables LTO when building a shared library (because previously the -flto hacks were only turned on in the static code for some reason). - build liblokinet as *either* shared library or static library, but not both. Building both makes things more complicated because they had different names (lokinet-shared or lokinet-static) and seems pointless: you generally want one or the other. Now there is just the liblokinet target, which will be shared or static depending on the value of BUILD_SHARED_LIBS. - Simplify lokinet-cryptography AVX2 code: just build *one* library, and add in the additional AVX2 files when possible, rather than building two and needing to merge them. - Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK. It makes no sense to use one of these (_RUNTIME) on Windows and the other on non-Windows when they appear to try to do the same thing. - remove a bunch of annotations from `endif(FOO)` -> `endif()`. - move all the tuntap compilation code (including OS-specific source file selection) into vendor/CMakeLists.txt and build tuntap as an intermediate OBJECT library rather than keeping a global variable in 5 different files. - move release motto define to root cmake; it made no sense being duplicated in both unix.cmake and win32.cmake - fix add_log_tag to not stomp on any existing source compile flags with its definition. Also use proper compile definition property instead of cramming it into compile flags. - make optimization/linker flags less hacky. There's no reason for us to force particular optimization flags because the cmake build type already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3). Not doing that also silences a bunch of cmake warnings because it thinks "-O0 -g3" etc. are link libraries (which is reasonable: that's what the code was telling cmake they are). - sets the default build type to RelWithDebInfo which gives us `-O2 -g` if you don't specify a build type. - Move PIC up (so that the things loaded in unix.cmake, notably libuv, have it set). - Add a custom `curl` interface library that carries the correct link target and include paths for curl (system or bundled).
2020-05-17 19:41:48 +00:00
STATIC_LINK ?= OFF
# build shared lib liblokinet.so instead of static library
BUILD_SHARED_LIBS ?= ON
# enable network namespace isolation
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
# cross compile?
2018-11-21 21:52:35 +00:00
CROSS ?= OFF
2019-01-12 01:19:24 +00:00
# enable generating coverage
2019-01-13 01:41:25 +00:00
COVERAGE ?= OFF
# allow downloading libsodium if >= 1.0.18 not installed
DOWNLOAD_SODIUM ?= OFF
2019-01-13 01:41:25 +00:00
COVERAGE_OUTDIR ?= "$(TMPDIR)/lokinet-coverage"
# tracy profiler
TRACY_ROOT ?=
2019-09-22 14:32:03 +00:00
# enable sanitizer
XSAN ?= False
# lokinet hive build
HIVE ?= OFF
2020-02-27 22:10:02 +00:00
# compile unittests
TESTS ?= ON
# cmake generator type
CMAKE_GEN ?= Unix Makefiles
ifdef NINJA
2019-07-22 22:20:17 +00:00
MAKE = $(NINJA)
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-03-30 11:44:43 +00:00
UNAME = $(shell which uname)
cmake refactor Refactors many things in cmake to improve and simplify: - don't use variable indirection for target names; target names are *already* a variable of sorts. (e.g. ${UTIL_LIB} is now just lokinet-util). cmake/basic_definitions.cmake is now gone. - fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather than shoving a bunch of flag hacks through link_libraries and add_compile_options. This also now enables LTO when building a shared library (because previously the -flto hacks were only turned on in the static code for some reason). - build liblokinet as *either* shared library or static library, but not both. Building both makes things more complicated because they had different names (lokinet-shared or lokinet-static) and seems pointless: you generally want one or the other. Now there is just the liblokinet target, which will be shared or static depending on the value of BUILD_SHARED_LIBS. - Simplify lokinet-cryptography AVX2 code: just build *one* library, and add in the additional AVX2 files when possible, rather than building two and needing to merge them. - Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK. It makes no sense to use one of these (_RUNTIME) on Windows and the other on non-Windows when they appear to try to do the same thing. - remove a bunch of annotations from `endif(FOO)` -> `endif()`. - move all the tuntap compilation code (including OS-specific source file selection) into vendor/CMakeLists.txt and build tuntap as an intermediate OBJECT library rather than keeping a global variable in 5 different files. - move release motto define to root cmake; it made no sense being duplicated in both unix.cmake and win32.cmake - fix add_log_tag to not stomp on any existing source compile flags with its definition. Also use proper compile definition property instead of cramming it into compile flags. - make optimization/linker flags less hacky. There's no reason for us to force particular optimization flags because the cmake build type already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3). Not doing that also silences a bunch of cmake warnings because it thinks "-O0 -g3" etc. are link libraries (which is reasonable: that's what the code was telling cmake they are). - sets the default build type to RelWithDebInfo which gives us `-O2 -g` if you don't specify a build type. - Move PIC up (so that the things loaded in unix.cmake, notably libuv, have it set). - Add a custom `curl` interface library that carries the correct link target and include paths for curl (system or bundled).
2020-05-17 19:41:48 +00:00
COMMON_CMAKE_OPTIONS = -DSTATIC_LINK=$(STATIC_LINK) -DBUILD_SHARED_LIBS=$(BUILD_SHARED_LIBS) -DUSE_NETNS=$(NETNS) -DUSE_AVX2=$(AVX2) -DDOWNLOAD_SODIUM=$(DOWNLOAD_SODIUM) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DXSAN=$(XSAN) -DWITH_HIVE=$(HIVE) -DWITH_TESTS=$(TESTS)
2019-03-30 11:44:43 +00:00
ifeq ($(shell $(UNAME)),SunOS)
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)'")
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
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)'")
else
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)'")
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)'")
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
ABYSS_EXE = $(BUILD_ROOT)/abyss-main
2018-10-23 11:29:37 +00:00
LINT_FILES = $(wildcard llarp/*.cpp)
LINT_CHECK = $(LINT_FILES:.cpp=.cpp-check)
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)
rm -f *.sig
rm -f *.a *.so
2018-05-16 15:59:24 +00:00
android-clean:
rm -rf $(ANDROID_DIR)/.externalNativeBuild
2018-10-23 11:29:37 +00:00
debug-configure:
mkdir -p '$(BUILD_ROOT)'
(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
release-configure: clean
2018-11-03 13:19:18 +00:00
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
debug: debug-configure
2019-02-08 13:12:07 +00:00
$(MAKE) -C $(BUILD_ROOT)
cp $(EXE) $(REPO)/lokinet
release-compile: release-configure
2019-02-08 13:12:07 +00:00
$(MAKE) -C $(BUILD_ROOT)
strip $(EXE)
$(TARGETS): release-compile
2019-11-26 11:52:55 +00:00
release: $(TARGETS)
make -C '$(BUILD_ROOT)' check
2018-06-06 13:17:03 +00:00
shadow-configure: clean
2018-11-08 15:15:02 +00:00
mkdir -p $(BUILD_ROOT)
$(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
testnet-clean: clean
rm -rf $(TESTNET_ROOT)
testnet-configure: testnet-clean
2018-11-08 15:15:02 +00:00
mkdir -p $(BUILD_ROOT)
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=1
testnet-build: testnet-configure
2019-02-08 13:12:07 +00:00
$(MAKE) -C $(BUILD_ROOT)
2020-02-02 16:31:01 +00:00
$(TESTNET_VENV):
$(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)
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'
LLARP_DEBUG=$(TESTNET_DEBUG) supervisord -n -d $(TESTNET_ROOT) -l $(TESTNET_LOG) -c $(TESTNET_CONF)
2018-06-06 13:17:03 +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
catch: debug
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) catch || test x$(CROSS) = xON
2018-06-14 14:04:42 +00:00
check: debug
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || test x$(CROSS) = xON
test: check
2019-12-26 13:01:29 +00:00
static-configure: $(LIBUV_PREFIX) $(LIBCURL_PREFIX)
cmake refactor Refactors many things in cmake to improve and simplify: - don't use variable indirection for target names; target names are *already* a variable of sorts. (e.g. ${UTIL_LIB} is now just lokinet-util). cmake/basic_definitions.cmake is now gone. - fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather than shoving a bunch of flag hacks through link_libraries and add_compile_options. This also now enables LTO when building a shared library (because previously the -flto hacks were only turned on in the static code for some reason). - build liblokinet as *either* shared library or static library, but not both. Building both makes things more complicated because they had different names (lokinet-shared or lokinet-static) and seems pointless: you generally want one or the other. Now there is just the liblokinet target, which will be shared or static depending on the value of BUILD_SHARED_LIBS. - Simplify lokinet-cryptography AVX2 code: just build *one* library, and add in the additional AVX2 files when possible, rather than building two and needing to merge them. - Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK. It makes no sense to use one of these (_RUNTIME) on Windows and the other on non-Windows when they appear to try to do the same thing. - remove a bunch of annotations from `endif(FOO)` -> `endif()`. - move all the tuntap compilation code (including OS-specific source file selection) into vendor/CMakeLists.txt and build tuntap as an intermediate OBJECT library rather than keeping a global variable in 5 different files. - move release motto define to root cmake; it made no sense being duplicated in both unix.cmake and win32.cmake - fix add_log_tag to not stomp on any existing source compile flags with its definition. Also use proper compile definition property instead of cramming it into compile flags. - make optimization/linker flags less hacky. There's no reason for us to force particular optimization flags because the cmake build type already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3). Not doing that also silences a bunch of cmake warnings because it thinks "-O0 -g3" etc. are link libraries (which is reasonable: that's what the code was telling cmake they are). - sets the default build type to RelWithDebInfo which gives us `-O2 -g` if you don't specify a build type. - Move PIC up (so that the things loaded in unix.cmake, notably libuv, have it set). - Add a custom `curl` interface library that carries the correct link target and include paths for curl (system or bundled).
2020-05-17 19:41:48 +00:00
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DBUILD_SHARED_LIBS=OFF -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 -DBUILD_SHARED_LIBS=OFF -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-12-26 13:01:29 +00:00
$(LIBCURL_PREFIX):
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)'
$(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
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)
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
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
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)
mkdir -p '$(BUILD_ROOT)'
2020-04-21 19:25:42 +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)'
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-12-11 21:05:40 +00:00
windows-release-configure: $(LIBUV_PREFIX)
2018-11-09 12:49:29 +00:00
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD_WINDOWS) -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PACKAGE=ON -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)'
$(CONFIG_CMD) -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PACKAGE=ON -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
$(MAKE) -C '$(BUILD_ROOT)'
2020-04-02 15:25:32 +00:00
mac: mac-release
$(MAKE) -C '$(BUILD_ROOT)' package
2020-04-02 15:25:32 +00:00
2018-05-21 14:28:15 +00:00
format:
2020-05-17 03:56:19 +00:00
$(FORMAT) -i $$(find jni daemon llarp include libabyss pybind | grep -E '\.[hc](pp)?$$')
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
analyze-config: clean
2018-10-27 19:03:23 +00:00
mkdir -p '$(BUILD_ROOT)'
$(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-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
docker-debian:
docker build -f docker/debian.Dockerfile .
docker-fedora:
docker build -f docker/fedora.Dockerfile .
2019-01-12 01:19:24 +00:00
install:
DESTDIR=$(DESTDIR) $(MAKE) -C '$(BUILD_ROOT)' install
2018-11-13 15:16:14 +00:00
doc: debug-configure
2020-03-30 12:09:35 +00:00
$(MAKE) -C $(BUILD_ROOT) clean
$(MAKE) -C $(BUILD_ROOT) doc
tarball:
OUT='lokinet-$(shell git describe --exact-match --tags $(git log -n1 --pretty='%h') 2> /dev/null || ( echo -n $(GIT_BRANCH)- && git rev-parse --short HEAD) ).tar.xz' sh -c 'git-archive-all -C $(REPO) --force-submodules $$OUT && rm -f $$OUT.sig && (gpg --sign --detach $$OUT || echo did not sign tarball)'