make-freebsd.mk 1.5 KB

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