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
|
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
|
|
|
|
2015-05-20 16:35:33 -07:00
|
|
|
# For internal use only -- signs everything with ZeroTier's developer cert
|
2014-01-07 13:06:34 -08:00
|
|
|
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
2015-05-20 16:35:33 -07:00
|
|
|
DEFS+=-DZT_OFFICIAL_RELEASE -DZT_AUTO_UPDATE
|
2014-01-07 13:06:34 -08:00
|
|
|
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
|
|
|
|
2015-05-20 19:38:49 -07:00
|
|
|
ifeq ($(ZT_AUTO_UPDATE),1)
|
|
|
|
DEFS+=-DZT_AUTO_UPDATE
|
|
|
|
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
|
|
|
|
|
2015-05-20 16:35:33 -07:00
|
|
|
# Debug mode -- dump trace output, build binary with -g
|
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
|
2015-04-16 14:55:36 -07:00
|
|
|
ln -sf zerotier-one zerotier-cli
|
2015-05-17 21:24:02 -07:00
|
|
|
$(CODESIGN) -f -s $(CODESIGN_CERT) zerotier-one
|
|
|
|
$(CODESIGN) -vvv zerotier-one
|
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-05-20 16:35:33 -07:00
|
|
|
# Requires Packages: http://s.sudre.free.fr/Software/Packages/about.html
|
|
|
|
mac-dist-pkg: FORCE
|
|
|
|
cd ext/installfiles/mac ; packagesbuild "ZeroTier One.pkgproj"
|
2015-05-17 21:24:02 -07:00
|
|
|
$(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.pkg"
|
|
|
|
$(CODESIGN) -vvv "ZeroTier One.pkg"
|
2013-12-16 22:30:37 -08:00
|
|
|
|
2015-05-20 16:35:33 -07: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 16:56:19 -04:00
|
|
|
clean:
|
2015-04-16 15:07:58 -07: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 zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-*
|
2013-07-04 16:56:19 -04: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:
|