make-linux.mk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. endif
  10. ifeq ($(ZT_AUTO_UPDATE),1)
  11. DEFS+=-DZT_AUTO_UPDATE
  12. endif
  13. # Uncomment to dump trace and log to stdout
  14. #DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
  15. # Uncomment for a release optimized build
  16. CFLAGS=-Wall -O3 -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  17. STRIP=strip --strip-all
  18. # Uncomment for a debug build
  19. #CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE $(DEFS)
  20. #STRIP=echo
  21. # Uncomment for gprof profile build
  22. #CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
  23. #STRIP=echo
  24. CXXFLAGS=$(CFLAGS) -fno-rtti
  25. include objects.mk
  26. all: one
  27. one: $(OBJS)
  28. $(CXX) $(CXXFLAGS) -o zerotier-one main.cpp $(OBJS) $(LIBS)
  29. $(STRIP) zerotier-one
  30. ln -sf zerotier-one zerotier-cli
  31. ln -sf zerotier-one zerotier-idtool
  32. selftest: $(OBJS)
  33. $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.cpp $(OBJS) $(LIBS)
  34. $(STRIP) zerotier-selftest
  35. idtool: $(OBJS)
  36. $(CXX) $(CXXFLAGS) -o zerotier-idtool idtool.cpp $(OBJS) $(LIBS)
  37. $(STRIP) zerotier-idtool
  38. installer: one FORCE
  39. ./buildinstaller.sh
  40. clean:
  41. rm -rf $(OBJS) zerotier-* build-* ZeroTierOneInstaller-*
  42. official: FORCE
  43. make -j 4 ZT_OFFICIAL_RELEASE=1
  44. ./buildinstaller.sh
  45. FORCE: