A library to scatter things accross a cluster depending on weights
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

83 行
2.7 KiB

  1. #
  2. # **************************************************************
  3. # * Simple C++ Makefile Template *
  4. # * *
  5. # * Author: Arash Partow (2003) *
  6. # * URL: http://www.partow.net/programming/makefile/index.html *
  7. # * *
  8. # * Copyright notice: *
  9. # * Free use of this C++ Makefile template is permitted under *
  10. # * the guidelines and in accordance with the the MIT License *
  11. # * http://www.opensource.org/licenses/MIT *
  12. # * *
  13. # **************************************************************
  14. #
  15. #
  16. # Modifications of the original file are licenced under MIT Licence
  17. #
  18. #(c) Ludovic 'Archivist' Lagouardette 2018
  19. #
  20. CXX := -g++-8
  21. CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -Wno-pedantic -O0 -std=gnu++2a -fPIC -DUSE_CATCH
  22. # -DCOMPAT_TLS
  23. # ^ Enable this flag if your compiler ABI have issues with thread local storage
  24. LDFLAGS := -L/usr/lib -lstdc++ -lm -lpthread
  25. BUILD := build
  26. OBJ_DIR := $(BUILD)/objects
  27. APP_DIR := $(BUILD)/apps
  28. TARGET := tests.cpp
  29. INCLUDE := -Iinclude/ -I9float/include
  30. SRC := \
  31. TEST_SRC := \
  32. $(wildcard src/tests/*.tests.cpp) \
  33. OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
  34. TEST_OBJECTS := $(TEST_SRC:%.cpp=$(OBJ_DIR)/%.o) $(OBJECTS)
  35. TARGETNAME := $(TARGET:%.cpp=%)
  36. all: build $(TARGET)
  37. $(OBJ_DIR)/%.test.o: %.cpp
  38. @mkdir -p $(@D)
  39. $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
  40. $(OBJ_DIR)/%.o: %.cpp
  41. @mkdir -p $(@D)
  42. $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
  43. $(TARGET): $(TEST_OBJECTS) build
  44. @mkdir -p $(@D)
  45. $(CXX) -DUSE_CATCH $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(TEST_OBJECTS)
  46. lib: $(OBJECTS) build
  47. $(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) --shared -o $(APP_DIR)/libscatter.so $(OBJECTS)
  48. ar rvs $(APP_DIR)/libscatter.a $(OBJECTS)
  49. install: lib
  50. cp $(APP_DIR)/libscatter.so /usr/local/lib
  51. cp $(APP_DIR)/libscatter.a /usr/local/lib
  52. mkdir -p /usr/local/include/scatter
  53. cp include/scatter/* /usr/local/include/scatter -r
  54. .PHONY: all build clean
  55. ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \
  56. --indent-namespaces --indent=tab --add-brackets
  57. format:
  58. -astyle $(ASTYLE_FLAGS) include/scatter/*
  59. -astyle $(ASTYLE_FLAGS) src/scatter/*
  60. -astyle $(ASTYLE_FLAGS) src/tests/*
  61. -astyle $(ASTYLE_FLAGS) include/*
  62. -astyle $(ASTYLE_FLAGS) src/*
  63. build:
  64. @mkdir -p $(APP_DIR)
  65. @mkdir -p $(OBJ_DIR)
  66. clean:
  67. rm -rf build/*
  68. rm -rf src/scatter/*.orig
  69. rm -rf include/scatter/*.orig