make-linux.mk 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Pick clang or gcc, with preference for clang
  2. CC=$(shell which clang gcc cc 2>/dev/null | head -n 1)
  3. CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1)
  4. INCLUDES=
  5. DEFS=
  6. LIBS=
  7. ifeq ($(ZT_OFFICIAL_RELEASE),1)
  8. ZT_AUTO_UPDATE=1
  9. DEFS+=-DZT_OFFICIAL_RELEASE
  10. endif
  11. ifeq ($(ZT_AUTO_UPDATE),1)
  12. DEFS+=-DZT_AUTO_UPDATE
  13. endif
  14. ifeq ($(ZT_USE_TESTNET),1)
  15. DEFS+=-DZT_USE_TESTNET
  16. endif
  17. # Enable SSE-optimized Salsa20
  18. DEFS+=-DZT_SALSA20_SSE
  19. # Uncomment to dump trace and log to stdout
  20. #DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
  21. # Uncomment for a release optimized build
  22. CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  23. LDFLAGS=-pie -Wl,-z,relro,-z,now
  24. STRIP=strip --strip-all
  25. # Uncomment for a debug build
  26. #CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE -DZT_LOG_STDOUT $(DEFS)
  27. #LDFLAGS=
  28. #STRIP=echo
  29. # Uncomment for gprof profile build
  30. #CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
  31. #LDFLAGS=
  32. #STRIP=echo
  33. CXXFLAGS=$(CFLAGS) -fno-rtti
  34. include objects.mk
  35. all: one
  36. one: $(OBJS) main.o
  37. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one main.o $(OBJS) $(LIBS)
  38. $(STRIP) zerotier-one
  39. ln -sf zerotier-one zerotier-cli
  40. ln -sf zerotier-one zerotier-idtool
  41. selftest: $(OBJS) selftest.o
  42. $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
  43. $(STRIP) zerotier-selftest
  44. installer: one FORCE
  45. ./buildinstaller.sh
  46. clean:
  47. rm -rf $(OBJS) *.o node/*.o zerotier-* build-* ZeroTierOneInstaller-*
  48. official: FORCE
  49. make -j 4 ZT_OFFICIAL_RELEASE=1
  50. ./buildinstaller.sh
  51. FORCE: