From 5dccf33b0804e5503beb82348dea695c47f0bddf Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Mon, 24 Jul 2023 12:58:44 -0700 Subject: [PATCH] Add makefile --- .gitmodules | 6 ++++++ ext/ZeroTierOne | 1 + ext/libzt | 1 + makefile | 28 ++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 .gitmodules create mode 160000 ext/ZeroTierOne create mode 160000 ext/libzt create mode 100644 makefile diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3b09543 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "ext/libzt"] + path = ext/libzt + url = https://github.com/zerotier/libzt.git +[submodule "ext/ZeroTierOne"] + path = ext/ZeroTierOne + url = https://github.com/zerotier/ZeroTierOne.git diff --git a/ext/ZeroTierOne b/ext/ZeroTierOne new file mode 160000 index 0000000..12e64aa --- /dev/null +++ b/ext/ZeroTierOne @@ -0,0 +1 @@ +Subproject commit 12e64aa1913abe65bf82fac9a1d8912140e441ab diff --git a/ext/libzt b/ext/libzt new file mode 160000 index 0000000..8d21a26 --- /dev/null +++ b/ext/libzt @@ -0,0 +1 @@ +Subproject commit 8d21a265cc23dd6e6e4d2c2ad068e978f110f8e3 diff --git a/makefile b/makefile new file mode 100644 index 0000000..d13902c --- /dev/null +++ b/makefile @@ -0,0 +1,28 @@ +CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1) +INCLUDES?=-Iext/libzt/ext/ZeroTierOne/osdep + +release: + git submodule update --init + git -C ext/libzt submodule update --init + -cp libzt.patch ext/libzt + -git -C ext/libzt apply --reject libzt.patch + cd ext/libzt && ./build.sh host "release" + clang++ -Wno-deprecated pylon.c -o pylon ext/libzt/dist/*-host-release/lib/libzt.a -Iext/libzt/include + +debug: + git submodule update --init + git -C ext/libzt submodule update --init + -cp libzt.patch ext/libzt + -git -C ext/libzt apply --reject libzt.patch + cd ext/libzt && ./build.sh host "debug" + clang++ -DPYLON_DEBUG=1 -g -Wno-deprecated pylon.c -o pylon-debug ext/libzt/dist/*-host-debug/lib/libzt.a -Iext/libzt/include -fsanitize=address -DASAN_OPTIONS=symbolize=1 + +relay: + $(CXX) -O3 -fno-rtti $(INCLUDES) -std=c++11 -frtti -o tcp-proxy tcp-proxy.cpp + +clean: + rm -rf pylon pylon-* + rm -f *.o tcp-proxy *.dSYM + +fmt: + clang-format -i pylon.c -style file \ No newline at end of file