summaryrefslogtreecommitdiff
path: root/make-linux.mk
diff options
context:
space:
mode:
Diffstat (limited to 'make-linux.mk')
-rw-r--r--make-linux.mk32
1 files changed, 14 insertions, 18 deletions
diff --git a/make-linux.mk b/make-linux.mk
index 855f7aae..b1bb2b93 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -26,7 +26,7 @@ ifeq ($(origin CXX),default)
CXX=$(shell if [ -e /usr/bin/clang++ ]; then echo clang++; else echo g++; fi)
endif
-UNAME_M=$(shell uname -m)
+UNAME_M=$(shell $(CC) -dumpmachine | cut -d '-' -f 1)
INCLUDES=
DEFS=
@@ -43,23 +43,7 @@ endif
ifeq ($(ZT_USE_MINIUPNPC),1)
DEFS+=-DZT_USE_MINIUPNPC
-ifeq ($(UNAME_M),armv6l)
- MINIUPNPC_LIB=ext/bin/miniupnpc/linux-arm32/libminiupnpc.a
-endif
-ifeq ($(UNAME_M),armv7l)
- MINIUPNPC_LIB=ext/bin/miniupnpc/linux-arm32/libminiupnpc.a
-endif
-ifeq ($(UNAME_M),x86_64)
- MINIUPNPC_LIB=ext/bin/miniupnpc/linux-x64/libminiupnpc.a
-endif
-ifeq ($(UNAME_M),i386)
- MINIUPNPC_LIB=ext/bin/miniupnpc/linux-x86/libminiupnpc.a
-endif
-ifeq ($(UNAME_M),i686)
- MINIUPNPC_LIB=ext/bin/miniupnpc/linux-x86/libminiupnpc.a
-endif
- MINIUPNPC_LIB?=-lminiupnpc
- LDLIBS+=$(MINIUPNPC_LIB)
+ LDLIBS+=ext/miniupnpc/libminiupnpc.a
OBJS+=osdep/UPNPClient.o
endif
@@ -70,6 +54,11 @@ ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1)
OBJS+=controller/SqliteNetworkController.o
endif
+# Build with ZT_ENABLE_CLUSTER=1 to build with cluster support
+ifeq ($(ZT_ENABLE_CLUSTER),1)
+ DEFS+=-DZT_ENABLE_CLUSTER
+endif
+
# "make debug" is a shortcut for this
ifeq ($(ZT_DEBUG),1)
DEFS+=-DZT_TRACE
@@ -88,6 +77,9 @@ else
LDFLAGS=-pie -Wl,-z,relro,-z,now
STRIP+=--strip-all
endif
+ifeq ($(ZT_TRACE),1)
+ DEFS+=-DZT_TRACE
+endif
# Uncomment for gprof profile build
#CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
@@ -98,6 +90,9 @@ endif
all: one
one: $(OBJS) one.o
+ifeq ($(ZT_USE_MINIUPNPC),1)
+ cd ext/miniupnpc ; make clean ; make 'CFLAGS=-O2 -fstack-protector -fPIE -fno-common -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600' -j 2 libminiupnpc.a
+endif
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) one.o $(LDLIBS)
$(STRIP) zerotier-one
ln -sf zerotier-one zerotier-idtool
@@ -112,6 +107,7 @@ installer: one FORCE
clean:
rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o zerotier-one zerotier-idtool zerotier-cli zerotier-selftest build-* ZeroTierOneInstaller-* *.deb *.rpm
+ cd ext/miniupnpc ; make clean
debug: FORCE
make ZT_DEBUG=1 one