Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. CXX_CMP = g++
  2. CXX_FLAGS = -std=c++17 -O3 -fPIC -w
  3. CXX_FLAGS_DBG = -std=c++17 -Wall -g
  4. CXX_SRC = libbinom/source/*.cpp libbinom/source/variables/*.cpp libbinom/source/file_storage/*.cpp libbinom/source/utils/*.cpp
  5. LD_SHARED_FLAGS = -fPIC -shared
  6. LD_FLAGS =
  7. ifeq ($(CXX_CMP), g++)
  8. LIBS = -lpthread -lstdc++fs
  9. endif
  10. ifeq ($(CXX_CMP), clang++)
  11. LIBS = -lpthread -lc++fs
  12. endif
  13. # Compile objects for libraries
  14. objects:
  15. $(CXX_CMP) -c -I. $(CXX_SRC) $(CXX_FLAGS)
  16. # Compile objects for Tcp
  17. objects_tcp:
  18. $(CXX_CMP) -c -I./TcpServer ./TcpServer/tcp/src/*.cpp $(CXX_FLAGS)
  19. # Compile objects for test (with debug symbols)
  20. objects_dbg:
  21. $(CXX_CMP) -c -I. $(CXX_SRC) $(CXX_FLAGS_DBG)
  22. # Compile objects for Tcp (with debug symbols)
  23. objects_tcp_dbg:
  24. $(CXX_CMP) -c -I./TcpServer ./TcpServer/tcp/src/*.cpp $(CXX_FLAGS_DBG)
  25. # Compile static library
  26. libbinom.a: objects
  27. ar cr libbinom.a *.o
  28. # Compile shared object
  29. libbinom.so: objects
  30. $(CXX_CMP) $(LD_SHARED_FLAGS) $(LIBS) -o libbinom.so *.o
  31. # Compile test programm with debug symbols
  32. test_dbg: objects_dbg
  33. $(CXX_CMP) -I. test.cpp *.o -o test $(LIBS) $(CXX_FLAGS_DBG)
  34. # Compile test programm
  35. test: objects
  36. $(CXX_CMP) -I. test.cpp *.o -o test $(LIBS) $(CXX_FLAGS)
  37. # Compile libraries and move to folder "lbinom" with C++ headers
  38. libs: libbinom.a libbinom.so
  39. # Toolkit
  40. tk: libbinom.a
  41. make clean_o
  42. $(CXX_CMP) -I. ./binomtk/*.cpp ./toolkit.cpp -o binom-tk $(LIBS) ./libbinom.a $(CXX_FLAGS)
  43. rm -rf ./*.o
  44. all: libs tk
  45. mkdir build -p
  46. mv libbinom.a build
  47. mv libbinom.so build
  48. mv binom-tk build
  49. cp libbinom/include build -r
  50. make clean
  51. clean:
  52. rm -rf ./*.o ./*.a test ./*.binom ./*.binomdb ./lbinom/ *.pro.user
  53. # Remove all object files
  54. clean_o:
  55. rm -rf *.o