|
|
- #
- # **************************************************************
- # * Simple C++ Makefile Template *
- # * *
- # * Author: Arash Partow (2003) *
- # * URL: http://www.partow.net/programming/makefile/index.html *
- # * *
- # * Copyright notice: *
- # * Free use of this C++ Makefile template is permitted under *
- # * the guidelines and in accordance with the the MIT License *
- # * http://www.opensource.org/licenses/MIT *
- # * *
- # **************************************************************
- #
- #
- # Modifications of the original file are licenced under MIT Licence
- #
- #(c) Ludovic 'Archivist' Lagouardette 2018
- #
-
-
- CXX := -g++-8
- CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -Wno-pedantic -O0 -std=gnu++2a -fPIC -DUSE_CATCH
- # -DCOMPAT_TLS
- # ^ Enable this flag if your compiler ABI have issues with thread local storage
- LDFLAGS := -L/usr/lib -lstdc++ -lm -lpthread
- BUILD := build
- OBJ_DIR := $(BUILD)/objects
- APP_DIR := $(BUILD)/apps
- TARGET := tests.cpp
- INCLUDE := -Iinclude/ -I9float/include
- SRC := \
-
- TEST_SRC := \
- $(wildcard src/tests/*.tests.cpp) \
-
- OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
- TEST_OBJECTS := $(TEST_SRC:%.cpp=$(OBJ_DIR)/%.o) $(OBJECTS)
- TARGETNAME := $(TARGET:%.cpp=%)
-
- all: build $(TARGET)
-
- $(OBJ_DIR)/%.test.o: %.cpp
- @mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
-
- $(OBJ_DIR)/%.o: %.cpp
- @mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
-
- $(TARGET): $(TEST_OBJECTS) build
- @mkdir -p $(@D)
- $(CXX) -DUSE_CATCH $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(TEST_OBJECTS)
-
- lib: $(OBJECTS) build
- $(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) --shared -o $(APP_DIR)/libscatter.so $(OBJECTS)
- ar rvs $(APP_DIR)/libscatter.a $(OBJECTS)
-
- install: lib
- cp $(APP_DIR)/libscatter.so /usr/local/lib
- cp $(APP_DIR)/libscatter.a /usr/local/lib
- mkdir -p /usr/local/include/scatter
- cp include/scatter/* /usr/local/include/scatter -r
-
- .PHONY: all build clean
-
- ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \
- --indent-namespaces --indent=tab --add-brackets
- format:
- -astyle $(ASTYLE_FLAGS) include/scatter/*
- -astyle $(ASTYLE_FLAGS) src/scatter/*
- -astyle $(ASTYLE_FLAGS) src/tests/*
- -astyle $(ASTYLE_FLAGS) include/*
- -astyle $(ASTYLE_FLAGS) src/*
-
- build:
- @mkdir -p $(APP_DIR)
- @mkdir -p $(OBJ_DIR)
-
- clean:
- rm -rf build/*
- rm -rf src/scatter/*.orig
- rm -rf include/scatter/*.orig
|