summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 5edae85..fda1936 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ TEST := \
piece-table-insert \
piece-table-internals
TEST_FILES = $(addprefix tests/, $(TEST))
-TEST_SOURCES = $(addsuffix .c, $(addprefix tests/, $(TEST)))
+TEST_LOGS = $(addsuffix .log, $(TEST_FILES))
all: $(TARGET)
@@ -28,14 +28,16 @@ clean:
rm -f $(TARGET)
rm -f out/*
rm -rf out/
- rm -f $(TEST_FILES)
+ rm -f $(TEST_FILES) $(TEST_LOGS)
-$(TEST_FILES): $(TARGET) $(TEST_SOURCES) $(HEADERS)
- @printf "Running %-40s%s " '`$@`'
- @$(CC) $(CFLAGS) -o $@ $(addsuffix .c, $@) $(OBJ)
- @result=$$(./$@ 2>&1); \
+$(TEST_FILES): tests/%: tests/%.c $(TARGET) $(HEADERS)
+ @$(CC) $(CFLAGS) -o $@ $< $(OBJ)
+
+$(TEST_LOGS): tests/%.log: tests/%
+ @printf "Running %-40s%s " '`$<`'
+ @result=$$(./$< 2>&1); \
ret=$$?; \
- printf "Exit value: %s\n%s" "$$ret" "$$result" >$@.log; \
+ printf "Exit value: %s\n%s" "$$ret" "$$result" > $@; \
if test $$ret -eq 0 ; then \
printf "\e[0;32mPASS\e[0m\n";\
else\
@@ -43,6 +45,6 @@ $(TEST_FILES): $(TARGET) $(TEST_SOURCES) $(HEADERS)
fi
check: test
-test: $(TEST_FILES)
+test: $(TEST_LOGS)
.PHONY: clean all test check