make-netbsd.mk 2.0 KB

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