A library to scatter things accross a cluster depending on weights
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

77 rindas
2.5 KiB

pirms 6 gadiem
  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