forked from vieter-v/libvieter
chore: separate target for each test binary
parent
3c8c33b47a
commit
6cf4eaaf0b
17
Makefile
17
Makefile
|
@ -17,6 +17,8 @@ OBJS_TEST := $(SRCS_TEST:%=$(BUILD_DIR)/%.o)
|
|||
DEPS := $(SRCS:%=$(BUILD_DIR)/%.d) $(SRCS_TEST:%=$(BUILD_DIR)/%.d)
|
||||
|
||||
BINS_TEST := $(OBJS_TEST:%.c.o=%)
|
||||
TARGETS_TEST := $(BINS_TEST:%=test-%)
|
||||
TARGETS_MEM_TEST := $(BINS_TEST:%=test-mem-%)
|
||||
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
|
@ -49,13 +51,18 @@ $(BUILD_DIR)/$(SRC_DIR)/%.c.o: $(SRC_DIR)/%.c
|
|||
|
||||
# =====TESTING=====
|
||||
.PHONY: test
|
||||
test: build-test
|
||||
@ $(foreach bin,$(BINS_TEST),./$(bin);)
|
||||
test: $(TARGETS_TEST)
|
||||
|
||||
.PHONY: test-mem
|
||||
test-mem: build-test
|
||||
@ $(foreach bin,$(BINS_TEST),valgrind --tool=memcheck --error-exitcode=1 \
|
||||
--track-origins=yes --leak-check=full ./$(bin);)
|
||||
test-mem: $(TARGETS_MEM_TEST)
|
||||
|
||||
.PHONY: $(TARGETS_TEST)
|
||||
$(TARGETS_TEST): test-%: %
|
||||
./$^
|
||||
|
||||
.PHONY: $(TARGETS_MEM_TEST)
|
||||
$(TARGETS_MEM_TEST): test-mem-%: %
|
||||
valgrind --tool=memcheck --error-exitcode=1 --track-origins=yes --leak-check=full ./$^
|
||||
|
||||
.PHONY: build-test
|
||||
build-test: $(BINS_TEST)
|
||||
|
|
Loading…
Reference in New Issue