clean up (?) the makefiles
This commit is contained in:
parent
0491c3655a
commit
d970e74ce3
2 changed files with 18 additions and 16 deletions
9
Makefile
9
Makefile
|
@ -16,7 +16,7 @@ PROG = $(addprefix $(SRC)/, $(_PROG))
|
|||
|
||||
OBJ = $(addprefix $(BIN)/, $(_PROG:.cpp=.o))
|
||||
|
||||
.PHONY: all clean
|
||||
.PHONY: all clean test
|
||||
|
||||
all: dirs $(NAME)
|
||||
|
||||
|
@ -53,4 +53,9 @@ $(PREPROCESSED)/%.cpp: $(SRC)/%.cpp
|
|||
$(CXX) -DPP_DEBUG $(CXXFLAGS) -E $< > $@
|
||||
clang-format -i $@
|
||||
|
||||
include test/Makefile
|
||||
test:
|
||||
@CXX="$(CXX)" \
|
||||
CXXFLAGS="$(CXXFLAGS)" \
|
||||
BIN="$(BIN)/test" \
|
||||
INCLUDE="$(INCLUDE)" \
|
||||
make -f test/Makefile
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
INCLUDE_TEST = include test
|
||||
CXXFLAGS += $(addprefix -I, $(INCLUDE_TEST))
|
||||
INCLUDE += test
|
||||
CXXFLAGS += $(addprefix -I, $(INCLUDE))
|
||||
|
||||
TEST = test
|
||||
BIN_TEST = $(BIN)/$(TEST)
|
||||
|
||||
_TESTS = example.cpp
|
||||
TESTS = $(addprefix $(TEST)/, $(_TESTS))
|
||||
|
||||
OBJ_TEST = $(addprefix $(BIN_TEST)/, $(_TESTS:.cpp=))
|
||||
OBJ = $(addprefix $(BIN)/, $(_TESTS:.cpp=))
|
||||
|
||||
.PHONY: test
|
||||
.PHONY: all
|
||||
|
||||
dirs_test:
|
||||
mkdir -p $(BIN_TEST)
|
||||
|
||||
test_start:
|
||||
all: dirs_test $(OBJ)
|
||||
@echo
|
||||
@echo "---------- STARTING TESTS ----------"
|
||||
@echo
|
||||
|
||||
test: dirs_test test_start $(OBJ_TEST)
|
||||
$(foreach _test,$(OBJ_TEST),@./$(_test))
|
||||
$(foreach test,$(OBJ),@./$(test))
|
||||
@echo
|
||||
@echo "---------- FINISHED TESTS ----------"
|
||||
@echo
|
||||
|
||||
$(BIN_TEST)/%: $(TEST)/%.cpp
|
||||
@$(CXX) $< $(CXXFLAGS) -o $@
|
||||
dirs_test:
|
||||
mkdir -p $(BIN)
|
||||
|
||||
$(BIN)/%: $(TEST)/%.cpp
|
||||
$(CXX) $< $(CXXFLAGS) -o $@
|
||||
|
|
Loading…
Reference in a new issue