Through lcthw ex13 plus some make rework
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
CFLAGS ?= -Wall -g
|
||||
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
|
||||
BUILD_TARGETS = ex1 ex3 ex7 ex8 ex9 ex10 ex11 ex12
|
||||
TEST_TARGETS = ex1 ex3 ex7 ex8 ex9 ex11 ex12
|
||||
BUILD_TARGETS = $(foreach ex,$(wildcard ex*.c),$(subst .c,,$(ex)))
|
||||
|
||||
.PHONY: all
|
||||
all: build test
|
||||
|
||||
.PHONY: echo
|
||||
echo:
|
||||
@echo BUILD_TARGETS=$(BUILD_TARGETS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(BUILD_TARGETS)
|
||||
@@ -15,16 +18,18 @@ build: $(BUILD_TARGETS)
|
||||
|
||||
.PHONY: gtest
|
||||
gtest:
|
||||
@$(foreach bt, $(TEST_TARGETS), make .gtest.$(bt) &&) \
|
||||
@$(foreach bt, $(BUILD_TARGETS), make .gtest.$(bt) &&) \
|
||||
printf '\ngYAY\n'
|
||||
|
||||
.gtest.%:
|
||||
@test_argv=$$(cat .$*.argv 2>/dev/null || echo) && \
|
||||
printf '\n==> %s\n' "$*" && $(GDBRUN) ./$*
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@$(foreach bt, $(TEST_TARGETS), make .test.$(bt) &&) \
|
||||
@$(foreach bt, $(BUILD_TARGETS), make .test.$(bt) &&) \
|
||||
printf '\nYAY\n'
|
||||
|
||||
.test.%:
|
||||
printf '\n==> %s\n' "$*" && ./$*
|
||||
@test_argv=$$(cat .$*.argv 2>/dev/null || echo) && \
|
||||
printf '\n==> %s\n' "$*" && ./$* $$test_argv
|
||||
|
Reference in New Issue
Block a user