make-freebsd.mk 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. ZT_AUTO_UPDATE=1
  11. DEFS+=-DZT_OFFICIAL_RELEASE
  12. endif
  13. ifeq ($(ZT_AUTO_UPDATE),1)
  14. DEFS+=-DZT_AUTO_UPDATE
  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=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  27. LDFLAGS=-pie -Wl,-z,relro,-z,now
  28. STRIP=strip --strip-all
  29. endif
  30. CXXFLAGS=$(CFLAGS) -fno-rtti
  31. all: one
  32. one: $(OBJS) one.o
  33. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
  34. $(STRIP) zerotier-one
  35. ln -sf zerotier-one zerotier-idtool
  36. ln -sf zerotier-one zerotier-cli
  37. selftest: $(OBJS) selftest.o
  38. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  39. $(STRIP) zerotier-selftest
  40. # No installer on FreeBSD yet
  41. #installer: one FORCE
  42. # ./buildinstaller.sh
  43. clean:
  44. 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-*
  45. debug: FORCE
  46. make -j 4 ZT_DEBUG=1
  47. #official: FORCE
  48. # make -j 4 ZT_OFFICIAL_RELEASE=1
  49. # ./buildinstaller.sh
  50. FORCE: