Makefile.linux 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. CC=gcc
  2. CXX=g++
  3. INCLUDES=-Iext/bin/libcrypto/include -Iext/jsoncpp/include
  4. ARCH=$(shell uname -m)
  5. DEFS=-DZT_ARCH="$(ARCH)" -DZT_OSNAME="linux" -DZT_TRACE
  6. # Uncomment for a release optimized build
  7. CFLAGS=-Wall -O3 -fno-unroll-loops -pthread $(INCLUDES) -DNDEBUG $(DEFS)
  8. STRIP=strip --strip-all
  9. # Uncomment for a debug build
  10. #CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE -DZT_LOG_STDOUT $(DEFS)
  11. #STRIP=echo
  12. CXXFLAGS=$(CFLAGS) -fno-rtti
  13. # We statically link against libcrypto because RedHat-derived distributions do
  14. # not ship the elliptic curve algorithms. If we didn't we'd have to build
  15. # separate binaries for the RedHat and Debian universes to distribute via
  16. # auto-update. This way we get one Linux binary for all systems of a given
  17. # architecture.
  18. LIBS=ext/bin/libcrypto/linux-$(ARCH)/libcrypto.a
  19. include objects.mk
  20. all: one launcher
  21. one: $(OBJS)
  22. $(CXX) $(CXXFLAGS) -o zerotier-one main.cpp $(OBJS) $(LIBS)
  23. $(STRIP) zerotier-one
  24. selftest: $(OBJS)
  25. $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.cpp $(OBJS) $(LIBS)
  26. $(STRIP) zerotier-selftest
  27. idtool: $(OBJS)
  28. $(CXX) $(CXXFLAGS) -o zerotier-idtool idtool.cpp $(OBJS) $(LIBS)
  29. $(STRIP) zerotier-idtool
  30. packtool: $(OBJS)
  31. $(CXX) $(CXXFLAGS) -o zerotier-packtool packtool.cpp $(OBJS) $(LIBS)
  32. $(STRIP) zerotier-packtool
  33. launcher:
  34. $(CC) -Os -o zerotier-launcher launcher.c
  35. $(STRIP) zerotier-launcher
  36. launcher-fakebin:
  37. $(CC) $(CFLAGS) -DZEROTIER_FAKE_VERSION_MAJOR=1 -DZEROTIER_FAKE_VERSION_MINOR=2 -DZEROTIER_FAKE_VERSION_REVISION=3 -o zerotier-launcher-fakebin-123 launcher-fakebin.c
  38. $(CC) $(CFLAGS) -DZEROTIER_FAKE_VERSION_MAJOR=1 -DZEROTIER_FAKE_VERSION_MINOR=2 -DZEROTIER_FAKE_VERSION_REVISION=4 -o zerotier-launcher-fakebin-124 launcher-fakebin.c
  39. clean:
  40. rm -f $(OBJS) zerotier-*