2015-07-24 20:17:41 +00:00
|
|
|
ifeq ($(origin CC),default)
|
|
|
|
CC=$(shell if [ -e /usr/bin/clang ]; then echo clang; else echo gcc; fi)
|
|
|
|
endif
|
|
|
|
ifeq ($(origin CXX),default)
|
|
|
|
CXX=$(shell if [ -e /usr/bin/clang++ ]; then echo clang++; else echo g++; fi)
|
|
|
|
endif
|
2013-07-04 20:56:19 +00:00
|
|
|
|
2015-07-28 21:48:26 +00:00
|
|
|
INCLUDES=
|
2015-10-27 16:41:12 +00:00
|
|
|
DEFS=
|
2013-12-13 21:49:46 +00:00
|
|
|
LIBS=
|
2015-04-15 21:54:37 +00:00
|
|
|
ARCH_FLAGS=-arch x86_64
|
2013-07-04 20:56:19 +00:00
|
|
|
|
2014-10-24 15:48:44 +00:00
|
|
|
include objects.mk
|
2015-07-28 21:32:02 +00:00
|
|
|
OBJS+=osdep/OSXEthernetTap.o
|
2014-10-24 15:48:44 +00:00
|
|
|
|
2014-01-10 05:15:00 +00:00
|
|
|
# Disable codesign since open source users will not have ZeroTier's certs
|
2014-01-07 21:06:34 +00:00
|
|
|
CODESIGN=echo
|
2015-06-03 02:17:39 +00:00
|
|
|
PRODUCTSIGN=echo
|
|
|
|
CODESIGN_APP_CERT=
|
|
|
|
CODESIGN_INSTALLER_CERT=
|
2014-01-07 21:06:34 +00:00
|
|
|
|
2015-11-17 02:28:55 +00:00
|
|
|
# Build with libminiupnpc by default for Mac
|
|
|
|
ZT_USE_MINIUPNPC?=1
|
|
|
|
|
2015-05-20 23:35:33 +00:00
|
|
|
# For internal use only -- signs everything with ZeroTier's developer cert
|
2014-01-07 21:06:34 +00:00
|
|
|
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
2015-07-28 21:32:02 +00:00
|
|
|
DEFS+=-DZT_OFFICIAL_RELEASE -DZT_AUTO_UPDATE
|
|
|
|
ZT_USE_MINIUPNPC=1
|
2014-01-07 21:06:34 +00:00
|
|
|
CODESIGN=codesign
|
2015-06-03 02:17:39 +00:00
|
|
|
PRODUCTSIGN=productsign
|
|
|
|
CODESIGN_APP_CERT="Developer ID Application: ZeroTier Networks LLC (8ZD9JUCZ4V)"
|
|
|
|
CODESIGN_INSTALLER_CERT="Developer ID Installer: ZeroTier Networks LLC (8ZD9JUCZ4V)"
|
2014-01-07 21:06:34 +00:00
|
|
|
endif
|
2014-10-24 15:48:44 +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-11-17 02:28:55 +00:00
|
|
|
DEFS+=-DZT_ENABLE_CLUSTER
|
2015-11-17 00:22:41 +00:00
|
|
|
endif
|
|
|
|
|
2015-05-21 02:38:49 +00:00
|
|
|
ifeq ($(ZT_AUTO_UPDATE),1)
|
2015-07-28 21:32:02 +00:00
|
|
|
DEFS+=-DZT_AUTO_UPDATE
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ZT_USE_MINIUPNPC),1)
|
2015-11-30 21:17:43 +00:00
|
|
|
DEFS+=-DMACOSX -DZT_USE_MINIUPNPC -DMINIUPNP_STATICLIB -D_DARWIN_C_SOURCE -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -DOS_STRING=\"Darwin/15.0.0\" -DMINIUPNPC_VERSION_STRING=\"1.9\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
|
2015-11-30 21:10:22 +00:00
|
|
|
OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o osdep/PortMapper.o
|
2015-05-21 02:38:49 +00:00
|
|
|
endif
|
|
|
|
|
2015-04-15 22:12:09 +00:00
|
|
|
# Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller
|
|
|
|
ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1)
|
2015-07-28 21:32:02 +00:00
|
|
|
DEFS+=-DZT_ENABLE_NETWORK_CONTROLLER
|
2015-03-12 21:03:53 +00:00
|
|
|
LIBS+=-L/usr/local/lib -lsqlite3
|
2015-07-28 21:32:02 +00:00
|
|
|
OBJS+=controller/SqliteNetworkController.o
|
2015-01-14 00:45:23 +00:00
|
|
|
endif
|
|
|
|
|
2015-05-20 23:35:33 +00:00
|
|
|
# Debug mode -- dump trace output, build binary with -g
|
2014-08-19 17:09:21 +00:00
|
|
|
ifeq ($(ZT_DEBUG),1)
|
2015-07-28 21:32:02 +00:00
|
|
|
DEFS+=-DZT_TRACE
|
2015-07-03 18:18:19 +00:00
|
|
|
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
2014-08-19 17:09:21 +00:00
|
|
|
STRIP=echo
|
2014-10-12 18:42:49 +00:00
|
|
|
# The following line enables optimization for the crypto code, since
|
|
|
|
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
2014-10-14 17:22:27 +00:00
|
|
|
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
2014-08-19 17:09:21 +00:00
|
|
|
else
|
2015-09-30 21:48:07 +00:00
|
|
|
CFLAGS?=-Ofast -fstack-protector
|
|
|
|
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
2014-08-19 17:09:21 +00:00
|
|
|
STRIP=strip
|
|
|
|
endif
|
2013-07-04 20:56:19 +00:00
|
|
|
|
|
|
|
CXXFLAGS=$(CFLAGS) -fno-rtti
|
|
|
|
|
2013-11-08 20:23:48 +00:00
|
|
|
all: one
|
2013-07-04 20:56:19 +00:00
|
|
|
|
2015-04-15 21:54:37 +00:00
|
|
|
one: $(OBJS) one.o
|
|
|
|
$(CXX) $(CXXFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
|
2013-07-04 20:56:19 +00:00
|
|
|
$(STRIP) zerotier-one
|
2013-12-04 22:44:28 +00:00
|
|
|
ln -sf zerotier-one zerotier-idtool
|
2015-04-16 21:55:36 +00:00
|
|
|
ln -sf zerotier-one zerotier-cli
|
2015-06-03 02:17:39 +00:00
|
|
|
$(CODESIGN) -f -s $(CODESIGN_APP_CERT) zerotier-one
|
2015-05-18 04:24:02 +00:00
|
|
|
$(CODESIGN) -vvv zerotier-one
|
2013-07-04 20:56:19 +00:00
|
|
|
|
2014-11-20 21:20:16 +00:00
|
|
|
selftest: $(OBJS) selftest.o
|
2014-08-19 17:09:21 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
|
2013-07-04 20:56:19 +00:00
|
|
|
$(STRIP) zerotier-selftest
|
|
|
|
|
2015-05-20 23:35:33 +00:00
|
|
|
# Requires Packages: http://s.sudre.free.fr/Software/Packages/about.html
|
|
|
|
mac-dist-pkg: FORCE
|
2015-06-02 18:59:05 +00:00
|
|
|
packagesbuild "ext/installfiles/mac/ZeroTier One.pkgproj"
|
2015-06-03 02:17:39 +00:00
|
|
|
rm -f "ZeroTier One Signed.pkg"
|
|
|
|
$(PRODUCTSIGN) --sign $(CODESIGN_INSTALLER_CERT) "ZeroTier One.pkg" "ZeroTier One Signed.pkg"
|
|
|
|
if [ -f "ZeroTier One Signed.pkg" ]; then mv -f "ZeroTier One Signed.pkg" "ZeroTier One.pkg"; fi
|
2013-12-17 06:30:37 +00:00
|
|
|
|
2015-05-20 23:35:33 +00:00
|
|
|
# For internal use only
|
|
|
|
official: FORCE
|
|
|
|
make clean
|
|
|
|
make -j 4 ZT_OFFICIAL_RELEASE=1
|
|
|
|
make ZT_OFFICIAL_RELEASE=1 mac-dist-pkg
|
|
|
|
|
2013-07-04 20:56:19 +00:00
|
|
|
clean:
|
2015-11-30 21:10:22 +00:00
|
|
|
rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-* mkworld
|
2013-07-04 20:56:19 +00:00
|
|
|
|
2014-08-19 17:09:21 +00:00
|
|
|
# For those building from source -- installs signed binary tap driver in system ZT home
|
|
|
|
install-mac-tap: FORCE
|
|
|
|
mkdir -p /Library/Application\ Support/ZeroTier/One
|
|
|
|
rm -rf /Library/Application\ Support/ZeroTier/One/tap.kext
|
|
|
|
cp -R ext/bin/tap-mac/tap.kext /Library/Application\ Support/ZeroTier/One
|
|
|
|
chown -R root:wheel /Library/Application\ Support/ZeroTier/One/tap.kext
|
|
|
|
|
2013-07-04 20:56:19 +00:00
|
|
|
FORCE:
|