|
@@ -20,49 +20,39 @@ |
|
|
# ========== Project settings ==========
|
|
|
# ========== Project settings ==========
|
|
|
# Excecutable's name
|
|
|
# Excecutable's name
|
|
|
TARGET := utlTest
|
|
|
TARGET := utlTest
|
|
|
|
|
|
|
|
|
# List(space seperated) of source directories
|
|
|
|
|
|
# ex:
|
|
|
|
|
|
# SRC_DIR_LIST := src1 /var/src2 ../src3
|
|
|
|
|
|
|
|
|
# Source directories list(space seperated). Full or relative path
|
|
|
SRC_DIR_LIST := tests gtest
|
|
|
SRC_DIR_LIST := tests gtest
|
|
|
|
|
|
|
|
|
# List(space seperated) of include directories
|
|
|
|
|
|
# ex:
|
|
|
|
|
|
# INC_DIR_LIST := inc /var/inc ../include2
|
|
|
|
|
|
|
|
|
# Include directories list(space seperated). Full or relative path
|
|
|
INC_DIR_LIST := ../include gtest
|
|
|
INC_DIR_LIST := ../include gtest
|
|
|
|
|
|
|
|
|
# List(space seperated) of exclude files (filenames only)
|
|
|
|
|
|
# ex:
|
|
|
|
|
|
|
|
|
# Exclude files list(space seperated). Filenames only.
|
|
|
# EXC_FILE_LIST := bad.cpp old.cpp
|
|
|
# EXC_FILE_LIST := bad.cpp old.cpp
|
|
|
EXC_FILE_LIST :=
|
|
|
|
|
|
|
|
|
|
|
|
# build directories
|
|
|
|
|
|
|
|
|
# Build directories
|
|
|
BUILD_DIR := bin
|
|
|
BUILD_DIR := bin
|
|
|
OBJ_DIR := $(BUILD_DIR)/obj
|
|
|
OBJ_DIR := $(BUILD_DIR)/obj
|
|
|
DEP_DIR := $(BUILD_DIR)/.dep
|
|
|
DEP_DIR := $(BUILD_DIR)/.dep
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ========== Compiler settings ==========
|
|
|
# ========== Compiler settings ==========
|
|
|
CLANGXX := clang++
|
|
|
CLANGXX := clang++
|
|
|
CLANGPP := clang++ -E
|
|
|
|
|
|
GCCXX := g++
|
|
|
GCCXX := g++
|
|
|
GCCPP := g++ -E
|
|
|
|
|
|
|
|
|
|
|
|
CXX := $(GCCXX)
|
|
|
|
|
|
CPP := $(GCCPP)
|
|
|
|
|
|
CSIZE := size
|
|
|
CSIZE := size
|
|
|
|
|
|
|
|
|
CFLAGS := -Wall -Wextra
|
|
|
|
|
|
DEB_FLAGS := -DDEBUG -g3
|
|
|
|
|
|
REL_FLAGS := -O2
|
|
|
|
|
|
# example: LDFLAGS := -pthread -lm
|
|
|
|
|
|
|
|
|
# Compiler flags for debug and release
|
|
|
|
|
|
DEB_CFLAGS := -DDEBUG -g3 -Wall -Wextra
|
|
|
|
|
|
REL_CFLAGS := -Wall -Wextra -O2
|
|
|
|
|
|
# Pre-defines
|
|
|
|
|
|
# PRE_DEFS := MYCAB=1729 SUPER_MODE
|
|
|
|
|
|
|
|
|
|
|
|
# ========== Linker settings ==========
|
|
|
|
|
|
# Linker flags
|
|
|
LDFLAGS := -pthread
|
|
|
LDFLAGS := -pthread
|
|
|
# example: MYCAB=1729 SUPER_MODE
|
|
|
|
|
|
PRE_DEFS :=
|
|
|
|
|
|
|
|
|
|
|
|
MAP_FILE := $(BUILD_DIR)/output.map
|
|
|
|
|
|
MAP_FLAG := -Xlinker -Map=$(MAP_FILE)
|
|
|
|
|
|
|
|
|
# Map output file
|
|
|
|
|
|
MAP_FILE := output.map
|
|
|
|
|
|
MAP_FLAG := -Xlinker -Map=$(BUILD_DIR)/$(MAP_FILE)
|
|
|
|
|
|
|
|
|
|
|
|
# ========== Default settings ==========
|
|
|
|
|
|
# compiler and compiler flagfs
|
|
|
|
|
|
CFLAGS := $(DEB_CFLAGS)
|
|
|
|
|
|
CXX := $(GCCXX)
|
|
|
|
|
|
|
|
|
#
|
|
|
#
|
|
|
# =========== Main body and Patterns ===========
|
|
|
# =========== Main body and Patterns ===========
|
|
@@ -72,7 +62,7 @@ DEF := $(foreach def,$(PRE_DEFS),-D$(def)) |
|
|
EXC := $(foreach fil,$(EXC_FILE_LIST), \
|
|
|
EXC := $(foreach fil,$(EXC_FILE_LIST), \
|
|
|
$(foreach dir,$(SRC_DIR_LIST),$(wildcard $(dir)/$(fil))) \
|
|
|
$(foreach dir,$(SRC_DIR_LIST),$(wildcard $(dir)/$(fil))) \
|
|
|
)
|
|
|
)
|
|
|
# source files. object and dependencies list
|
|
|
|
|
|
|
|
|
# source files, object and dependencies list
|
|
|
# recursive search into current and source directories
|
|
|
# recursive search into current and source directories
|
|
|
SRC := $(wildcard *.cpp)
|
|
|
SRC := $(wildcard *.cpp)
|
|
|
SRC += $(foreach dir,$(SRC_DIR_LIST),$(wildcard $(dir)/*.cpp))
|
|
|
SRC += $(foreach dir,$(SRC_DIR_LIST),$(wildcard $(dir)/*.cpp))
|
|
@@ -92,7 +82,7 @@ DEP := $(foreach file,$(SRC:%.cpp=%.d),$(DEP_DIR)$(file)) |
|
|
# Invoke cpp to create makefile rules with dependencies for each source file
|
|
|
# Invoke cpp to create makefile rules with dependencies for each source file
|
|
|
$(DEP_DIR)%.d: %.cpp
|
|
|
$(DEP_DIR)%.d: %.cpp
|
|
|
@mkdir -p $(@D)
|
|
|
@mkdir -p $(@D)
|
|
|
@$(CPP) $(CFLAGS) $(INC) $(DEF) -MM -MT $(OBJ_DIR)$(<:.cpp=.o) -MF $@ $<
|
|
|
|
|
|
|
|
|
@$(CXX) -E $(CFLAGS) $(INC) $(DEF) -MM -MT $(OBJ_DIR)$(<:.cpp=.o) -MF $@ $<
|
|
|
|
|
|
|
|
|
# objects depent on .cpp AND dependency files, which have an empty recipe
|
|
|
# objects depent on .cpp AND dependency files, which have an empty recipe
|
|
|
$(OBJ_DIR)%.o: %.cpp $(DEP_DIR)%.d
|
|
|
$(OBJ_DIR)%.o: %.cpp $(DEP_DIR)%.d
|
|
@@ -130,57 +120,45 @@ clean: |
|
|
#
|
|
|
#
|
|
|
|
|
|
|
|
|
.PHONY: gcc14
|
|
|
.PHONY: gcc14
|
|
|
gcc14: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
gcc14: CFLAGS += -std=c++14
|
|
|
gcc14: CFLAGS += -std=c++14
|
|
|
gcc14: $(BUILD_DIR)/$(TARGET)
|
|
|
gcc14: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: gcc14_conc
|
|
|
.PHONY: gcc14_conc
|
|
|
gcc14_conc: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
gcc14_conc: CFLAGS += -std=c++14 -fconcepts
|
|
|
gcc14_conc: CFLAGS += -std=c++14 -fconcepts
|
|
|
gcc14_conc: $(BUILD_DIR)/$(TARGET)
|
|
|
gcc14_conc: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: gcc17
|
|
|
.PHONY: gcc17
|
|
|
gcc17: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
gcc17: CFLAGS += -std=c++17
|
|
|
gcc17: CFLAGS += -std=c++17
|
|
|
gcc17: $(BUILD_DIR)/$(TARGET)
|
|
|
gcc17: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: gcc17_conc
|
|
|
.PHONY: gcc17_conc
|
|
|
gcc17_conc: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
gcc17_conc: CFLAGS += -std=c++17 -fconcepts
|
|
|
gcc17_conc: CFLAGS += -std=c++17 -fconcepts
|
|
|
gcc17_conc: $(BUILD_DIR)/$(TARGET)
|
|
|
gcc17_conc: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: gcc2a
|
|
|
.PHONY: gcc2a
|
|
|
gcc2a: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
gcc2a: CFLAGS += -std=c++2a
|
|
|
gcc2a: CFLAGS += -std=c++2a
|
|
|
gcc2a: $(BUILD_DIR)/$(TARGET)
|
|
|
gcc2a: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: clang14
|
|
|
.PHONY: clang14
|
|
|
clang14: CXX := $(CLANGXX)
|
|
|
clang14: CXX := $(CLANGXX)
|
|
|
clang14: CPP := $(CLANGPP)
|
|
|
|
|
|
clang14: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
clang14: CFLAGS += -std=c++14
|
|
|
clang14: CFLAGS += -std=c++14
|
|
|
clang14: $(BUILD_DIR)/$(TARGET)
|
|
|
clang14: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: clang17
|
|
|
.PHONY: clang17
|
|
|
clang14: CXX := $(CLANGXX)
|
|
|
|
|
|
clang14: CPP := $(CLANGPP)
|
|
|
|
|
|
clang14: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
clang14: CFLAGS += -std=c++17
|
|
|
|
|
|
clang14: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
clang17: CXX := $(CLANGXX)
|
|
|
|
|
|
clang17: CFLAGS += -std=c++17
|
|
|
|
|
|
clang17: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: clang2a
|
|
|
.PHONY: clang2a
|
|
|
clang14: CXX := $(CLANGXX)
|
|
|
|
|
|
clang14: CPP := $(CLANGPP)
|
|
|
|
|
|
clang14: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
clang14: CFLAGS += -std=c++2a
|
|
|
|
|
|
clang14: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
clang2a: CXX := $(CLANGXX)
|
|
|
|
|
|
clang2a: CFLAGS += -std=c++2a
|
|
|
|
|
|
clang2a: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: debug
|
|
|
.PHONY: debug
|
|
|
debug: CFLAGS += $(DEB_FLAGS)
|
|
|
|
|
|
debug: $(BUILD_DIR)/$(TARGET)
|
|
|
debug: $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: release
|
|
|
.PHONY: release
|
|
|
release: CFLAGS += $(REL_FLAGS)
|
|
|
|
|
|
|
|
|
release: CFLAGS := $(REL_FLAGS)
|
|
|
release: clean $(BUILD_DIR)/$(TARGET)
|
|
|
release: clean $(BUILD_DIR)/$(TARGET)
|
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
.PHONY: all
|
|
|