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)
|
DEPS := $(SRCS:%=$(BUILD_DIR)/%.d) $(SRCS_TEST:%=$(BUILD_DIR)/%.d)
|
||||||
|
|
||||||
BINS_TEST := $(OBJS_TEST:%.c.o=%)
|
BINS_TEST := $(OBJS_TEST:%.c.o=%)
|
||||||
|
TARGETS_TEST := $(BINS_TEST:%=test-%)
|
||||||
|
TARGETS_MEM_TEST := $(BINS_TEST:%=test-mem-%)
|
||||||
|
|
||||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||||
|
|
||||||
|
@ -49,13 +51,18 @@ $(BUILD_DIR)/$(SRC_DIR)/%.c.o: $(SRC_DIR)/%.c
|
||||||
|
|
||||||
# =====TESTING=====
|
# =====TESTING=====
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: build-test
|
test: $(TARGETS_TEST)
|
||||||
@ $(foreach bin,$(BINS_TEST),./$(bin);)
|
|
||||||
|
|
||||||
.PHONY: test-mem
|
.PHONY: test-mem
|
||||||
test-mem: build-test
|
test-mem: $(TARGETS_MEM_TEST)
|
||||||
@ $(foreach bin,$(BINS_TEST),valgrind --tool=memcheck --error-exitcode=1 \
|
|
||||||
--track-origins=yes --leak-check=full ./$(bin);)
|
.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
|
.PHONY: build-test
|
||||||
build-test: $(BINS_TEST)
|
build-test: $(BINS_TEST)
|
||||||
|
|
Loading…
Reference in New Issue