make-linux.mk 1.4 KB

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