make-freebsd.mk 2.0 KB

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