aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorc2023-12-24 10:28:00 -0500
committerc2023-12-24 10:28:00 -0500
commite39267c83a8af189a624891813ebd6014543b01a (patch)
treec6ad5a39246e4560f6efd77b9d2e4383394bbbf9 /Makefile
parent1494ecaeba2307e489b1df210abb3c63415419ed (diff)
Proper tests.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 12 insertions, 4 deletions
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