make-freebsd.mk 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # Build with ZT_ENABLE_NETCONF_MASTER=1 to build with NetworkConfigMaster enabled
  30. ifeq ($(ZT_ENABLE_NETCONF_MASTER),1)
  31. DEFS+=-DZT_ENABLE_NETCONF_MASTER
  32. LIBS+=-lsqlite3
  33. OBJS+=netconf/SqliteNetworkConfigMaster.o
  34. endif
  35. # "make official" is a shortcut for this
  36. ifeq ($(ZT_OFFICIAL_RELEASE),1)
  37. ZT_AUTO_UPDATE=1
  38. DEFS+=-DZT_OFFICIAL_RELEASE
  39. endif
  40. ifeq ($(ZT_AUTO_UPDATE),1)
  41. DEFS+=-DZT_AUTO_UPDATE
  42. endif
  43. # "make debug" is a shortcut for this
  44. ifeq ($(ZT_DEBUG),1)
  45. # DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
  46. CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
  47. LDFLAGS=
  48. STRIP=echo
  49. # The following line enables optimization for the crypto code, since
  50. # C25519 in particular is almost UNUSABLE in heavy testing without it.
  51. ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
  52. else
  53. CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  54. LDFLAGS=-pie -Wl,-z,relro,-z,now
  55. STRIP=strip --strip-all
  56. endif
  57. CXXFLAGS=$(CFLAGS) -fno-rtti
  58. all: one
  59. one: $(OBJS) main.o
  60. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one main.o $(OBJS) $(LIBS)
  61. $(STRIP) zerotier-one
  62. ln -sf zerotier-one zerotier-cli
  63. ln -sf zerotier-one zerotier-idtool
  64. selftest: $(OBJS) selftest.o
  65. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  66. $(STRIP) zerotier-selftest
  67. testnet: $(TESTNET_OBJS) $(OBJS) testnet.o
  68. $(CXX) $(CXXFLAGS) -o zerotier-testnet testnet.o $(OBJS) $(TESTNET_OBJS) $(LIBS)
  69. $(STRIP) zerotier-testnet
  70. # No installer on FreeBSD yet
  71. #installer: one FORCE
  72. # ./buildinstaller.sh
  73. clean:
  74. rm -rf $(OBJS) $(TESTNET_OBJS) node/*.o osnet/*.o control/*.o testnet/*.o *.o zerotier-* build-* ZeroTierOneInstaller-*
  75. debug: FORCE
  76. make -j 4 ZT_DEBUG=1
  77. #official: FORCE
  78. # make -j 4 ZT_OFFICIAL_RELEASE=1
  79. # ./buildinstaller.sh
  80. FORCE: