2018-05-16 15:59:24 +00:00
|
|
|
|
2018-05-27 16:45:04 +00:00
|
|
|
all: debug
|
2018-05-16 16:41:20 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
SIGN = gpg --sign --detach
|
|
|
|
|
2018-06-07 16:22:49 +00:00
|
|
|
REPO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
|
2018-06-28 15:10:25 +00:00
|
|
|
CC ?= cc
|
|
|
|
CXX ?= c++
|
2018-06-07 16:22:49 +00:00
|
|
|
|
2018-06-28 15:10:25 +00:00
|
|
|
TARGETS = lokinet
|
2018-05-28 13:49:44 +00:00
|
|
|
SIGS = $(TARGETS:=.sig)
|
|
|
|
|
2018-07-20 04:50:28 +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
|
|
|
|
SHADOW_PLUGIN=$(REPO)/libshadow-plugin-llarp.so
|
|
|
|
SHADOW_LOG=$(REPO)/shadow.log.txt
|
2018-06-06 17:02:57 +00:00
|
|
|
|
2018-07-20 04:50:28 +00:00
|
|
|
SHADOW_SRC ?= $(HOME)/git/shadow
|
|
|
|
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 '.*'
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-07-17 04:37:50 +00:00
|
|
|
TESTNET_EXE=$(REPO)/lokinet
|
2018-07-12 13:43:37 +00:00
|
|
|
TESTNET_CLIENTS ?= 50
|
|
|
|
TESTNET_SERVERS ?= 50
|
|
|
|
TESTNET_DEBUG ?= 0
|
|
|
|
|
2018-05-27 16:45:04 +00:00
|
|
|
clean:
|
2018-05-21 14:28:15 +00:00
|
|
|
rm -f build.ninja rules.ninja cmake_install.cmake CMakeCache.txt
|
|
|
|
rm -rf CMakeFiles
|
2018-06-28 15:10:25 +00:00
|
|
|
rm -f $(TARGETS) llarpd
|
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-05-16 15:59:24 +00:00
|
|
|
|
2018-07-19 21:08:11 +00:00
|
|
|
debug-configure:
|
2018-06-28 15:10:25 +00:00
|
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DWITH_TESTS=ON -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
2018-05-16 15:59:24 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
release-configure: clean
|
2018-06-28 15:10:25 +00:00
|
|
|
cmake -GNinja -DSTATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
2018-05-28 13:49:44 +00:00
|
|
|
|
2018-05-27 16:45:04 +00:00
|
|
|
debug: debug-configure
|
2018-05-16 15:57:16 +00:00
|
|
|
ninja
|
2018-06-14 14:04:42 +00:00
|
|
|
ninja test
|
2018-05-21 14:28:15 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
release-compile: release-configure
|
|
|
|
ninja
|
2018-06-28 15:10:25 +00:00
|
|
|
cp llarpd lokinet
|
2018-05-28 13:49:44 +00:00
|
|
|
strip $(TARGETS)
|
|
|
|
|
|
|
|
$(TARGETS): release-compile
|
|
|
|
|
2018-06-28 15:10:25 +00:00
|
|
|
|
2018-05-28 13:49:44 +00:00
|
|
|
%.sig: $(TARGETS)
|
|
|
|
$(SIGN) $*
|
|
|
|
|
|
|
|
release: $(SIGS)
|
|
|
|
|
2018-06-06 13:17:03 +00:00
|
|
|
shadow-configure: clean
|
2018-06-28 15:10:25 +00:00
|
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DSHADOW=ON -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
2018-06-06 13:17:03 +00:00
|
|
|
|
2018-06-06 17:02:57 +00:00
|
|
|
shadow-build: shadow-configure
|
|
|
|
ninja clean
|
2018-06-06 13:17:03 +00:00
|
|
|
ninja
|
|
|
|
|
2018-07-20 04:50:28 +00:00
|
|
|
shadow-run: shadow-build
|
2018-06-06 17:02:57 +00:00
|
|
|
python3 contrib/shadow/genconf.py $(SHADOW_CONFIG)
|
2018-07-20 04:50:28 +00:00
|
|
|
bash -c "$(SHADOW_BIN) -w $$(cat /proc/cpuinfo | grep processor | wc -l) $(SHADOW_CONFIG) | $(SHADOW_PARSE)"
|
|
|
|
|
|
|
|
shadow-plot: shadow-run
|
|
|
|
$(SHADOW_PLOT)
|
|
|
|
|
|
|
|
shadow: shadow-plot
|
2018-06-07 16:22:49 +00:00
|
|
|
|
|
|
|
testnet-configure: clean
|
2018-06-28 15:10:25 +00:00
|
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX)
|
2018-06-07 16:22:49 +00:00
|
|
|
|
|
|
|
testnet-build: testnet-configure
|
|
|
|
ninja
|
|
|
|
|
2018-07-17 04:37:50 +00:00
|
|
|
$(TESTNET_EXE): testnet-build
|
|
|
|
cp -f $(REPO)/llarpd $(TESTNET_EXE)
|
2018-07-16 03:32:13 +00:00
|
|
|
|
2018-07-17 04:37:50 +00:00
|
|
|
testnet: $(TESTNET_EXE)
|
2018-06-07 16:22:49 +00:00
|
|
|
mkdir -p $(TESTNET_ROOT)
|
2018-07-17 04:37:50 +00:00
|
|
|
python3 contrib/testnet/genconf.py --bin=$(TESTNET_EXE) --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF)
|
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
|
|
|
|
2018-06-14 14:04:42 +00:00
|
|
|
test: debug-configure
|
2018-06-20 12:34:48 +00:00
|
|
|
ninja
|
2018-06-14 14:04:42 +00:00
|
|
|
ninja test
|
|
|
|
|
2018-05-21 14:28:15 +00:00
|
|
|
format:
|
2018-05-21 14:31:52 +00:00
|
|
|
clang-format -i $$(find daemon llarp include | grep -E '\.[h,c](pp)?$$')
|
2018-07-17 04:37:50 +00:00
|
|
|
|
|
|
|
fuzz-configure: clean
|
|
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Fuzz -DCMAKE_C_COMPILER=afl-gcc -DCMAKE_CXX_COMPILER=afl-g++
|
|
|
|
|
|
|
|
fuzz-build: fuzz-configure
|
|
|
|
ninja
|
|
|
|
|
|
|
|
fuzz: fuzz-build
|
|
|
|
$(EXE)
|