2014-11-04 19:20:38 +00:00
|
|
|
INCLUDES=
|
|
|
|
DEFS=
|
|
|
|
LIBS=
|
|
|
|
|
|
|
|
include objects.mk
|
2017-01-19 23:16:04 +00:00
|
|
|
OBJS+=osdep/BSDEthernetTap.o ext/http-parser/http_parser.o
|
2014-11-04 19:20:38 +00:00
|
|
|
|
2015-11-17 00:22:41 +00:00
|
|
|
# Build with ZT_ENABLE_CLUSTER=1 to build with cluster support
|
|
|
|
ifeq ($(ZT_ENABLE_CLUSTER),1)
|
2015-12-04 21:19:31 +00:00
|
|
|
DEFS+=-DZT_ENABLE_CLUSTER
|
2015-11-17 00:22:41 +00:00
|
|
|
endif
|
|
|
|
|
2014-11-04 19:20:38 +00:00
|
|
|
# "make debug" is a shortcut for this
|
|
|
|
ifeq ($(ZT_DEBUG),1)
|
2015-12-04 21:19:31 +00:00
|
|
|
DEFS+=-DZT_TRACE
|
2015-07-03 18:18:19 +00:00
|
|
|
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
|
|
|
LDFLAGS+=
|
2014-11-04 19:20:38 +00:00
|
|
|
STRIP=echo
|
|
|
|
# The following line enables optimization for the crypto code, since
|
|
|
|
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
2017-01-19 23:16:04 +00:00
|
|
|
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
2014-11-04 19:20:38 +00:00
|
|
|
else
|
2015-07-03 18:18:19 +00:00
|
|
|
CFLAGS?=-O3 -fstack-protector
|
|
|
|
CFLAGS+=-Wall -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
|
|
|
LDFLAGS+=-pie -Wl,-z,relro,-z,now
|
2014-11-04 19:20:38 +00:00
|
|
|
STRIP=strip --strip-all
|
|
|
|
endif
|
|
|
|
|
2017-01-12 21:18:11 +00:00
|
|
|
# Determine system build architecture from compiler target
|
|
|
|
CC_MACH=$(shell $(CC) -dumpmachine | cut -d '-' -f 1)
|
|
|
|
ZT_ARCHITECTURE=0
|
|
|
|
ifeq ($(CC_MACH),x86_64)
|
|
|
|
ZT_ARCHITECTURE=2
|
|
|
|
endif
|
|
|
|
ifeq ($(CC_MACH),amd64)
|
|
|
|
ZT_ARCHITECTURE=2
|
|
|
|
endif
|
|
|
|
ifeq ($(CC_MACH),i386)
|
|
|
|
ZT_ARCHITECTURE=1
|
|
|
|
endif
|
|
|
|
ifeq ($(CC_MACH),i686)
|
|
|
|
ZT_ARCHITECTURE=1
|
|
|
|
endif
|
|
|
|
ifeq ($(CC_MACH),arm)
|
|
|
|
ZT_ARCHITECTURE=3
|
|
|
|
endif
|
|
|
|
ifeq ($(CC_MACH),arm64)
|
|
|
|
ZT_ARCHITECTURE=4
|
|
|
|
endif
|
|
|
|
ifeq ($(CC_MACH),aarch64)
|
|
|
|
ZT_ARCHITECTURE=4
|
|
|
|
endif
|
2017-01-19 23:05:26 +00:00
|
|
|
DEFS+=-DZT_BUILD_PLATFORM=$(ZT_BUILD_PLATFORM) -DZT_BUILD_ARCHITECTURE=$(ZT_ARCHITECTURE) -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\""
|
2017-01-12 21:18:11 +00:00
|
|
|
|
2017-01-20 18:07:25 +00:00
|
|
|
CXXFLAGS+=$(CFLAGS) -fno-rtti -std=c++11 -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH -D_GLIBCXX_USE_C99_MATH_TR1
|
2014-11-04 19:20:38 +00:00
|
|
|
|
|
|
|
all: one
|
|
|
|
|
2015-12-04 21:19:31 +00:00
|
|
|
one: $(OBJS) service/OneService.o one.o
|
|
|
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) service/OneService.o one.o $(LIBS)
|
2014-11-04 19:20:38 +00:00
|
|
|
$(STRIP) zerotier-one
|
|
|
|
ln -sf zerotier-one zerotier-idtool
|
2015-04-16 21:55:36 +00:00
|
|
|
ln -sf zerotier-one zerotier-cli
|
2014-11-04 19:20:38 +00:00
|
|
|
|
|
|
|
selftest: $(OBJS) selftest.o
|
|
|
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
|
|
|
|
$(STRIP) zerotier-selftest
|
|
|
|
|
|
|
|
clean:
|
2017-01-19 23:16:04 +00:00
|
|
|
rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o build-* zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-*
|
2014-11-04 19:20:38 +00:00
|
|
|
|
|
|
|
debug: FORCE
|
|
|
|
make -j 4 ZT_DEBUG=1
|
|
|
|
|
2017-01-19 23:15:31 +00:00
|
|
|
install: one
|
|
|
|
rm -f /usr/local/sbin/zerotier-one
|
|
|
|
cp zerotier-one /usr/local/sbin
|
|
|
|
ln -sf /usr/local/sbin/zerotier-one /usr/local/sbin/zerotier-cli
|
|
|
|
ln -sf /usr/local/sbin/zerotier-one /usr/local/bin/zerotier-idtool
|
|
|
|
|
|
|
|
uninstall: FORCE
|
|
|
|
rm -rf /usr/local/sbin/zerotier-one /usr/local/sbin/zerotier-cli /usr/local/bin/zerotier-idtool /var/db/zerotier-one/zerotier-one.port /var/db/zerotier-one/zerotier-one.pid /var/db/zerotier-one/iddb.d
|
|
|
|
|
2014-11-04 19:20:38 +00:00
|
|
|
FORCE:
|