Makefile.linux 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 -fstack-protector -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 -lm
  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. launcher:
  31. $(CC) -Os -o zerotier-launcher launcher.c
  32. $(STRIP) zerotier-launcher
  33. launcher-fakebin:
  34. $(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
  35. $(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
  36. clean:
  37. rm -f $(OBJS) zerotier-*