From e39267c83a8af189a624891813ebd6014543b01a Mon Sep 17 00:00:00 2001 From: c Date: Sun, 24 Dec 2023 10:28:00 -0500 Subject: Proper tests. --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a50dbbf..e4a0a22 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,10 @@ CFLAGS := $(REG_CFLAGS) SRCS := $(wildcard src/*.c) SRCS := $(filter-out %doer.c,$(SRCS)) # Filter out incomplete doer for now. OBJS := $(SRCS:.c=.o) +TEST_SRCS := $(wildcard test/*.c) +TEST_OUTS := $(TEST_SRCS:.c=.out) -.PHONY: all reg_options dbg_options halk dbg install uninstall clean me a sandwich +.PHONY: all reg_options dbg_options halk dbg install uninstall clean test me a sandwich all: halk @@ -30,12 +32,18 @@ halk: reg_options $(OBJS) $(CC) $(OBJS) $(REG_CFLAGS) -o $(BIN).out dbg: CFLAGS := $(DBG_CFLAGS) -dbg: TEST := -D TEST dbg: dbg_options $(OBJS) $(CC) $(OBJS) $(DBG_CFLAGS) -o $(BIN).out +test: dbg $(TEST_OUTS) + set -e + for f in $(TEST_OUTS); do ./$$f; done + %.o: %.c - $(CC) $(TEST) -c $< -o $@ + $(CC) -c $< -o $@ + +%.out: %.c + $(CC) $< $(filter-out %main.o,$(OBJS)) -o $@ install: all mkdir -p $(PREFIX) @@ -46,7 +54,7 @@ uninstall: rm -f $(PREFIX)/$(BIN) clean: - rm -f $(BIN).out src/*.o + rm -f $(BIN).out src/*.o test/*.out me a: @exit -- cgit v1.2.3