2013-10-28 15:53:40 -04:00
|
|
|
CC=clang
|
|
|
|
CXX=clang++
|
2013-07-04 16:56:19 -04:00
|
|
|
|
2015-01-06 17:16:54 -08:00
|
|
|
INCLUDES=-I/usr/local/include
|
2013-12-11 13:14:10 -08:00
|
|
|
DEFS=
|
2013-12-13 13:49:46 -08:00
|
|
|
LIBS=
|
2015-04-15 14:54:37 -07:00
|
|
|
ARCH_FLAGS=-arch x86_64
|
2013-07-04 16:56:19 -04:00
|
|
|
|
2014-10-24 08:48:44 -07:00
|
|
|
include objects.mk
|
2015-04-08 18:47:06 -07:00
|
|
|
OBJS+=osdep/OSXEthernetTap.o
|
2015-04-15 14:54:37 -07:00
|
|
|
#TESTNET_OBJS=testnet/SimNet.o testnet/SimNetSocketManager.o testnet/TestEthernetTap.o
|
2014-10-24 08:48:44 -07:00
|
|
|
|
2014-01-09 21:15:00 -08:00
|
|
|
# Disable codesign since open source users will not have ZeroTier's certs
|
2014-01-07 13:06:34 -08:00
|
|
|
CODESIGN=echo
|
2014-01-09 21:15:00 -08:00
|
|
|
CODESIGN_CERT=
|
2014-01-07 13:06:34 -08:00
|
|
|
|
|
|
|
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
2014-10-24 08:48:44 -07:00
|
|
|
# For use by ZeroTier Networks -- sign with developer cert
|
2014-01-07 13:06:34 -08:00
|
|
|
ZT_AUTO_UPDATE=1
|
|
|
|
DEFS+=-DZT_OFFICIAL_RELEASE
|
|
|
|
CODESIGN=codesign
|
2014-01-09 21:15:00 -08:00
|
|
|
CODESIGN_CERT="Developer ID Application: ZeroTier Networks LLC (8ZD9JUCZ4V)"
|
2014-01-07 13:06:34 -08:00
|
|
|
endif
|
2014-10-24 08:48:44 -07:00
|
|
|
|
2013-12-11 13:14:10 -08:00
|
|
|
ifeq ($(ZT_AUTO_UPDATE),1)
|
2013-12-31 11:22:54 -08:00
|
|
|
DEFS+=-DZT_AUTO_UPDATE
|
2013-12-11 13:14:10 -08:00
|
|
|
endif
|
|
|
|
|
2015-04-15 15:12:09 -07:00
|
|
|
# Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller
|
|
|
|
ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1)
|
|
|
|
DEFS+=-DZT_ENABLE_NETWORK_CONTROLLER
|
2015-03-12 14:03:53 -07:00
|
|
|
LIBS+=-L/usr/local/lib -lsqlite3
|
2015-04-15 15:12:09 -07:00
|
|
|
OBJS+=controller/SqliteNetworkController.o
|
2015-01-13 16:45:23 -08:00
|
|
|
endif
|
|
|
|
|
2014-10-24 08:48:44 -07:00
|
|
|
# Enable SSE-optimized Salsa20 -- all Intel macs support SSE2
|
2014-07-15 17:56:09 -07:00
|
|
|
DEFS+=-DZT_SALSA20_SSE
|
|
|
|
|
2014-08-19 10:09:21 -07:00
|
|
|
ifeq ($(ZT_DEBUG),1)
|
2015-04-09 20:54:00 -07:00
|
|
|
DEFS+=-DZT_TRACE
|
2014-10-12 11:42:49 -07:00
|
|
|
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
2014-08-19 10:09:21 -07:00
|
|
|
STRIP=echo
|
2014-10-12 11:42:49 -07: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 10:22:27 -07: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 10:09:21 -07:00
|
|
|
else
|
2015-04-15 14:54:37 -07:00
|
|
|
CFLAGS=$(ARCH_FLAGS) -Wall -O3 -flto -fPIE -fvectorize -fstack-protector -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
2014-08-19 10:09:21 -07:00
|
|
|
STRIP=strip
|
|
|
|
endif
|
2013-07-04 16:56:19 -04:00
|
|
|
|
|
|
|
CXXFLAGS=$(CFLAGS) -fno-rtti
|
|
|
|
|
2013-11-08 15:23:48 -05:00
|
|
|
all: one
|
2013-07-04 16:56:19 -04:00
|
|
|
|
2015-04-15 14:54:37 -07:00
|
|
|
one: $(OBJS) one.o
|
|
|
|
$(CXX) $(CXXFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
|
2013-07-04 16:56:19 -04:00
|
|
|
$(STRIP) zerotier-one
|
2013-12-04 14:44:28 -08:00
|
|
|
ln -sf zerotier-one zerotier-idtool
|
2013-07-04 16:56:19 -04:00
|
|
|
|
2014-11-20 13:20:16 -08:00
|
|
|
selftest: $(OBJS) selftest.o
|
2014-08-19 10:09:21 -07:00
|
|
|
$(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
|
2013-07-04 16:56:19 -04:00
|
|
|
$(STRIP) zerotier-selftest
|
|
|
|
|
2015-04-14 13:56:28 -07:00
|
|
|
#testnet: $(TESTNET_OBJS) $(OBJS) testnet.o
|
|
|
|
# $(CXX) $(CXXFLAGS) -o zerotier-testnet testnet.o $(OBJS) $(TESTNET_OBJS) $(LIBS)
|
|
|
|
# $(STRIP) zerotier-testnet
|
2014-10-23 16:46:09 -07:00
|
|
|
|
2014-08-19 10:09:21 -07:00
|
|
|
# Requires that ../Qt be symlinked to the Qt root to use for UI build
|
2015-04-14 13:56:28 -07:00
|
|
|
#mac-ui: FORCE
|
|
|
|
# mkdir -p build-ZeroTierUI-release
|
|
|
|
# cd build-ZeroTierUI-release ; ../../Qt/bin/qmake ../ZeroTierUI/ZeroTierUI.pro ; make -j 4
|
|
|
|
# strip "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One"
|
|
|
|
# find "build-ZeroTierUI-release/ZeroTier One.app" -type f -name '.DS_Store' -print0 | xargs -0 rm -f
|
|
|
|
# $(CODESIGN) -f -s $(CODESIGN_CERT) "build-ZeroTierUI-release/ZeroTier One.app"
|
|
|
|
# $(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app"
|
2013-12-16 22:30:37 -08:00
|
|
|
|
2013-07-04 16:56:19 -04:00
|
|
|
clean:
|
2015-04-15 19:38:01 -07:00
|
|
|
rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o zerotier-one zerotier-idtool zerotier-selftest ZeroTierOneInstaller-*
|
2013-07-04 16:56:19 -04:00
|
|
|
|
2014-08-19 10:09:21 -07:00
|
|
|
# For our use -- builds official signed binary, packages in installer and download DMG
|
2014-01-07 14:48:56 -08:00
|
|
|
official: FORCE
|
|
|
|
make -j 4 ZT_OFFICIAL_RELEASE=1
|
|
|
|
./buildinstaller.sh
|
2015-04-15 14:54:37 -07:00
|
|
|
# make mac-dmg ZT_OFFICIAL_RELEASE=1
|
|
|
|
|
|
|
|
#mac-dmg: FORCE
|
|
|
|
# mkdir -p build-ZeroTierOne-dmg
|
|
|
|
# cd build-ZeroTierOne-dmg ; ln -sf /Applications Applications
|
|
|
|
# cp -a "build-ZeroTierUI-release/ZeroTier One.app" build-ZeroTierOne-dmg/
|
|
|
|
# rm -f /tmp/tmp.dmg
|
|
|
|
# hdiutil create /tmp/tmp.dmg -ov -volname "ZeroTier One" -fs HFS+ -srcfolder ./build-ZeroTierOne-dmg
|
|
|
|
# hdiutil convert /tmp/tmp.dmg -format UDZO -o "ZeroTier One.dmg"
|
|
|
|
# $(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.dmg"
|
|
|
|
# rm -f /tmp/tmp.dmg
|
2014-01-07 14:48:56 -08:00
|
|
|
|
2014-08-19 10:09:21 -07: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 16:56:19 -04:00
|
|
|
FORCE:
|