Makefile 854 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. CXX := g++
  2. SYS = $(shell $(CXX) -dumpmachine)
  3. STATIC := no
  4. DEBUG := no
  5. SYG_SRC = sygcpp.cpp x25519.cpp sha512.cpp
  6. SYGCPP = _build/sygcpp
  7. CXXFLAGS := -march=core2
  8. ifeq ($(DEBUG),yes)
  9. CXXFLAGS += -g -O3
  10. # CXXFLAGS += -g -Og
  11. else
  12. CXXFLAGS += -O3
  13. LDFLAGS := -s
  14. endif
  15. SYG_OBJS = $(patsubst %.cpp,_build/obj/%.o,$(SYG_SRC))
  16. ifneq (, $(findstring mingw, $(SYS))$(findstring cygwin, $(SYS)))
  17. include Makefile.mingw
  18. else
  19. ifeq ($(STATIC),yes)
  20. LIBPATH = /usr/lib/$(SYS)
  21. LDLIBS = -pthread $(LIBPATH)/libsodium.a -lpthread -ldl
  22. else
  23. LDLIBS = -lsodium -lpthread
  24. endif
  25. endif
  26. all: mk_obj_dir $(SYGCPP)
  27. mk_obj_dir:
  28. @mkdir -p _build/obj/windows
  29. clean:
  30. $(RM) -r _build/obj $(SYGCPP)
  31. _build/obj/%.o: %.cpp
  32. $(CXX) -c $(CXXFLAGS) $< -o $@
  33. $(SYGCPP): $(SYG_OBJS)
  34. $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
  35. .PHONY: all
  36. .PHONY: clean
  37. .PHONY: mk_obj_dir