make-freebsd.mk 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. CC=cc
  2. CXX=c++
  3. INCLUDES=
  4. DEFS=
  5. LIBS=
  6. include objects.mk
  7. OBJS+=osnet/BSDEthernetTapFactory.o osnet/BSDEthernetTap.o osnet/BSDRoutingTable.o
  8. TESTNET_OBJS=testnet/SimNet.o testnet/SimNetSocketManager.o testnet/TestEthernetTap.o testnet/TestEthernetTapFactory.o testnet/TestRoutingTable.o
  9. # Enable SSE-optimized Salsa20 on x86 and x86_64 machines
  10. MACHINE=$(shell uname -m)
  11. ifeq ($(MACHINE),x86_64)
  12. DEFS+=-DZT_SALSA20_SSE
  13. endif
  14. ifeq ($(MACHINE),amd64)
  15. DEFS+=-DZT_SALSA20_SSE
  16. endif
  17. ifeq ($(MACHINE),i686)
  18. DEFS+=-DZT_SALSA20_SSE
  19. endif
  20. ifeq ($(MACHINE),i586)
  21. DEFS+=-DZT_SALSA20_SSE
  22. endif
  23. ifeq ($(MACHINE),i386)
  24. DEFS+=-DZT_SALSA20_SSE
  25. endif
  26. ifeq ($(MACHINE),x86)
  27. DEFS+=-DZT_SALSA20_SSE
  28. endif
  29. # "make official" is a shortcut for this
  30. ifeq ($(ZT_OFFICIAL_RELEASE),1)
  31. ZT_AUTO_UPDATE=1
  32. DEFS+=-DZT_OFFICIAL_RELEASE
  33. endif
  34. ifeq ($(ZT_AUTO_UPDATE),1)
  35. DEFS+=-DZT_AUTO_UPDATE
  36. endif
  37. # "make debug" is a shortcut for this
  38. ifeq ($(ZT_DEBUG),1)
  39. # DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
  40. CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
  41. LDFLAGS=
  42. STRIP=echo
  43. # The following line enables optimization for the crypto code, since
  44. # C25519 in particular is almost UNUSABLE in heavy testing without it.
  45. ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
  46. else
  47. CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  48. LDFLAGS=-pie -Wl,-z,relro,-z,now
  49. STRIP=strip --strip-all
  50. endif
  51. CXXFLAGS=$(CFLAGS) -fno-rtti
  52. all: one
  53. one: $(OBJS) main.o
  54. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one main.o $(OBJS) $(LIBS)
  55. $(STRIP) zerotier-one
  56. ln -sf zerotier-one zerotier-cli
  57. ln -sf zerotier-one zerotier-idtool
  58. selftest: $(OBJS) selftest.o
  59. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  60. $(STRIP) zerotier-selftest
  61. testnet: $(TESTNET_OBJS) $(OBJS) testnet.o
  62. $(CXX) $(CXXFLAGS) -o zerotier-testnet testnet.o $(OBJS) $(TESTNET_OBJS) $(LIBS)
  63. $(STRIP) zerotier-testnet
  64. # No installer on FreeBSD yet
  65. #installer: one FORCE
  66. # ./buildinstaller.sh
  67. clean:
  68. rm -rf $(OBJS) $(TESTNET_OBJS) node/*.o osnet/*.o control/*.o testnet/*.o *.o zerotier-* build-* ZeroTierOneInstaller-*
  69. debug: FORCE
  70. make -j 4 ZT_DEBUG=1
  71. #official: FORCE
  72. # make -j 4 ZT_OFFICIAL_RELEASE=1
  73. # ./buildinstaller.sh
  74. FORCE: