make-freebsd.mk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. CC=cc
  2. CXX=c++
  3. INCLUDES=
  4. DEFS=
  5. LIBS=
  6. include objects.mk
  7. OBJS+=osdep/BSDEthernetTap.o
  8. # "make official" is a shortcut for this
  9. ifeq ($(ZT_OFFICIAL_RELEASE),1)
  10. DEFS+=-DZT_OFFICIAL_RELEASE
  11. endif
  12. # Build with ZT_ENABLE_CLUSTER=1 to build with cluster support
  13. ifeq ($(ZT_ENABLE_CLUSTER),1)
  14. DEFS+=-DZT_ENABLE_CLUSTER
  15. endif
  16. # "make debug" is a shortcut for this
  17. ifeq ($(ZT_DEBUG),1)
  18. DEFS+=-DZT_TRACE
  19. CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
  20. LDFLAGS+=
  21. STRIP=echo
  22. # The following line enables optimization for the crypto code, since
  23. # C25519 in particular is almost UNUSABLE in heavy testing without it.
  24. ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
  25. else
  26. CFLAGS?=-O3 -fstack-protector
  27. CFLAGS+=-Wall -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  28. LDFLAGS+=-pie -Wl,-z,relro,-z,now
  29. STRIP=strip --strip-all
  30. endif
  31. CXXFLAGS+=$(CFLAGS) -fno-rtti
  32. all: one
  33. one: $(OBJS) service/OneService.o one.o
  34. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) service/OneService.o one.o $(LIBS)
  35. $(STRIP) zerotier-one
  36. ln -sf zerotier-one zerotier-idtool
  37. ln -sf zerotier-one zerotier-cli
  38. selftest: $(OBJS) selftest.o
  39. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  40. $(STRIP) zerotier-selftest
  41. # No installer on FreeBSD yet
  42. #installer: one FORCE
  43. # ./buildinstaller.sh
  44. clean:
  45. 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-*
  46. debug: FORCE
  47. make -j 4 ZT_DEBUG=1
  48. #official: FORCE
  49. # make -j 4 ZT_OFFICIAL_RELEASE=1
  50. # ./buildinstaller.sh
  51. FORCE: