make-netbsd.mk 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. CC=gcc
  2. CXX=g++
  3. INCLUDES=
  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 diagnostic/dump_interfaces_netbsd.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+=-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 -fpermissive
  32. CPPFLAGS += -I.
  33. all: one
  34. one: $(OBJS) service/OneService.o diagnostic/dump_sections.o diagnostic/dump_interfaces_netbsd.o one.o diagnostic/node_state_json.o diagnostic/node_state_sections.o diagnostic/node_state_interfaces_netbsd.o
  35. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) service/OneService.o diagnostic/dump_sections.o diagnostic/dump_interfaces_netbsd.o one.o diagnostic/node_state_json.o diagnostic/node_state_sections.o diagnostic/node_state_interfaces_netbsd.o $(LIBS)
  36. $(STRIP) zerotier-one
  37. ln -sf zerotier-one zerotier-idtool
  38. ln -sf zerotier-one zerotier-cli
  39. selftest: $(OBJS) selftest.o
  40. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  41. $(STRIP) zerotier-selftest
  42. # No installer on FreeBSD yet
  43. #installer: one FORCE
  44. # ./buildinstaller.sh
  45. clean:
  46. 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-* diagnostic/*.o
  47. debug: FORCE
  48. make -j 4 ZT_DEBUG=1
  49. #official: FORCE
  50. # make -j 4 ZT_OFFICIAL_RELEASE=1
  51. # ./buildinstaller.sh
  52. FORCE: