make-mac.mk 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. CC=clang
  2. CXX=clang++
  3. INCLUDES=-I/usr/local/include
  4. DEFS=
  5. LIBS=
  6. ARCH_FLAGS=-arch x86_64
  7. include objects.mk
  8. OBJS+=osdep/OSXEthernetTap.o
  9. # Disable codesign since open source users will not have ZeroTier's certs
  10. CODESIGN=echo
  11. CODESIGN_CERT=
  12. # For internal use only -- signs everything with ZeroTier's developer cert
  13. ifeq ($(ZT_OFFICIAL_RELEASE),1)
  14. DEFS+=-DZT_OFFICIAL_RELEASE -DZT_AUTO_UPDATE
  15. CODESIGN=codesign
  16. CODESIGN_CERT="Developer ID Application: ZeroTier Networks LLC (8ZD9JUCZ4V)"
  17. endif
  18. ifeq ($(ZT_AUTO_UPDATE),1)
  19. DEFS+=-DZT_AUTO_UPDATE
  20. endif
  21. # Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller
  22. ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1)
  23. DEFS+=-DZT_ENABLE_NETWORK_CONTROLLER
  24. LIBS+=-L/usr/local/lib -lsqlite3
  25. OBJS+=controller/SqliteNetworkController.o
  26. endif
  27. # Enable SSE-optimized Salsa20 -- all Intel macs support SSE2
  28. DEFS+=-DZT_SALSA20_SSE
  29. # Debug mode -- dump trace output, build binary with -g
  30. ifeq ($(ZT_DEBUG),1)
  31. DEFS+=-DZT_TRACE
  32. CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
  33. STRIP=echo
  34. # The following line enables optimization for the crypto code, since
  35. # C25519 in particular is almost UNUSABLE in heavy testing without it.
  36. ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
  37. else
  38. CFLAGS=$(ARCH_FLAGS) -Wall -O3 -flto -fPIE -fvectorize -fstack-protector -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
  39. STRIP=strip
  40. endif
  41. CXXFLAGS=$(CFLAGS) -fno-rtti
  42. all: one
  43. one: $(OBJS) one.o
  44. $(CXX) $(CXXFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
  45. $(STRIP) zerotier-one
  46. ln -sf zerotier-one zerotier-idtool
  47. ln -sf zerotier-one zerotier-cli
  48. $(CODESIGN) -f -s $(CODESIGN_CERT) zerotier-one
  49. $(CODESIGN) -vvv zerotier-one
  50. selftest: $(OBJS) selftest.o
  51. $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  52. $(STRIP) zerotier-selftest
  53. # Requires Packages: http://s.sudre.free.fr/Software/Packages/about.html
  54. mac-dist-pkg: FORCE
  55. cd ext/installfiles/mac ; packagesbuild "ZeroTier One.pkgproj"
  56. $(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.pkg"
  57. $(CODESIGN) -vvv "ZeroTier One.pkg"
  58. # For internal use only
  59. official: FORCE
  60. make clean
  61. make -j 4 ZT_OFFICIAL_RELEASE=1
  62. make ZT_OFFICIAL_RELEASE=1 mac-dist-pkg
  63. clean:
  64. 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-*
  65. # For those building from source -- installs signed binary tap driver in system ZT home
  66. install-mac-tap: FORCE
  67. mkdir -p /Library/Application\ Support/ZeroTier/One
  68. rm -rf /Library/Application\ Support/ZeroTier/One/tap.kext
  69. cp -R ext/bin/tap-mac/tap.kext /Library/Application\ Support/ZeroTier/One
  70. chown -R root:wheel /Library/Application\ Support/ZeroTier/One/tap.kext
  71. FORCE: