|
|
@@ -0,0 +1,61 @@ |
|
|
|
# documentation here |
|
|
|
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html |
|
|
|
# http://www.partow.net/programming/makefile/index.html |
|
|
|
|
|
|
|
CXX ?= g++ |
|
|
|
GCXX_DEBUG = -ggdb -DDEBUG -g |
|
|
|
CFLAGS = -pedantic-errors -Wall -Wextra --std=c++14 $(GCXX_DEBUG) # -Werror |
|
|
|
LDFLAGS = # $(shell pkg-config --libs libcrypto jsoncpp) |
|
|
|
INCLUDE = -Iinclude/ |
|
|
|
|
|
|
|
# path # |
|
|
|
BIN_DIR = ./bin |
|
|
|
OBJ_DIR = ./obj |
|
|
|
SRC_DIR = ./src |
|
|
|
SRC_EXT = .cpp |
|
|
|
TARGET = out.ex |
|
|
|
|
|
|
|
# code lists # |
|
|
|
# List all source files in the source directory |
|
|
|
SRC := \ |
|
|
|
$(wildcard $(SRC_DIR)/module1/*$(SRC_EXT)) \ |
|
|
|
$(wildcard $(SRC_DIR)/*$(SRC_EXT)) \ |
|
|
|
|
|
|
|
# Set the object file names, with the source directory stripped |
|
|
|
# from the path, and the build path prepended in its place |
|
|
|
OBJECTS = $(SRC:$(SRC_DIR)/%.$(SRC_EXT)=$(OBJ_DIR)/%.o) |
|
|
|
|
|
|
|
all: $(BIN_DIR)/$(TARGET) |
|
|
|
|
|
|
|
$(OBJ_DIR)/%.o: %$(SRC_EXT) |
|
|
|
$(CXX) $(CFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS) |
|
|
|
|
|
|
|
$(BIN_DIR)/$(TARGET): $(OBJECTS) |
|
|
|
$(CXX) $(CFLAGS) -o $(BIN_DIR)/$(TARGET) $^ $(LDFLAGS) |
|
|
|
|
|
|
|
all: |
|
|
|
|
|
|
|
.PHONY: all debug release valgrind clean markdown doxygenconf |
|
|
|
|
|
|
|
debug: CFLAGS += $(GCXX_DEBUG) |
|
|
|
debug: all |
|
|
|
|
|
|
|
release: CFLAGS += -O2 |
|
|
|
release: all |
|
|
|
|
|
|
|
# debug target |
|
|
|
valgrind: |
|
|
|
@valgrind --leak-check=full --track-origins=yes $(BIN_DIR)/$(TARGET) file |
|
|
|
|
|
|
|
clean: |
|
|
|
@rm -f $(OBJ_DIR)/*.o |
|
|
|
@rm -f $(BIN_DIR)/*.ex |
|
|
|
|
|
|
|
markdown: |
|
|
|
@pandoc --defaults=pandoc-config.yaml |
|
|
|
|
|
|
|
doxygenconf: |
|
|
|
@doxygen -g doxygen.conf |
|
|
|
|
|
|
|
doc: doxygen.conf |
|
|
|
@doxygen doxygen.conf |