A library to scatter things accross a cluster depending on weights
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

77 righe
2.5 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++-7
  21. CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -O0 -std=c++14 -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/
  30. SRC := \
  31. OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
  32. TEST_OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.test.o)
  33. TARGETNAME := $(TARGET:%.cpp=%)
  34. all: build $(TARGET)
  35. $(OBJ_DIR)/%.test.o: %.cpp
  36. @mkdir -p $(@D)
  37. $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
  38. $(OBJ_DIR)/%.o: %.cpp
  39. @mkdir -p $(@D)
  40. $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
  41. $(TARGET): $(TEST_OBJECTS) build
  42. @mkdir -p $(@D)
  43. $(CXX) -DUSE_CATCH $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(TEST_OBJECTS)
  44. lib: $(OBJECTS) build
  45. $(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) --shared -o $(APP_DIR)/libscatter.so $(OBJECTS)
  46. ar rvs $(APP_DIR)/libscatter.a $(OBJECTS)
  47. install: lib
  48. cp $(APP_DIR)/libscatter.so /usr/local/lib
  49. cp $(APP_DIR)/libscatter.a /usr/local/lib
  50. mkdir -p /usr/local/include/scatter
  51. cp include/scatter/* /usr/local/include/scatter -r
  52. .PHONY: all build clean
  53. ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \
  54. --indent-namespaces --indent=tab --add-brackets
  55. format:
  56. astyle $(ASTYLE_FLAGS) include/scatter/*
  57. astyle $(ASTYLE_FLAGS) src/scatter/*
  58. build:
  59. @mkdir -p $(APP_DIR)
  60. @mkdir -p $(OBJ_DIR)
  61. clean:
  62. rm -rf build/*
  63. rm -rf src/scatter/*.orig
  64. rm -rf include/scatter/*.orig