summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-04-05 16:07:39 -0300
committerEuAndreh <eu@euandre.org>2024-04-05 17:08:08 -0300
commitea60b1b08015060a08b1ead38e4e81c44a88017f (patch)
tree9be302cafc856410383e1b1ab315f8b1a371153d /Makefile
parentgit mv meta.capim meta.weave (diff)
downloadpindaiba-ea60b1b08015060a08b1ead38e4e81c44a88017f.tar.gz
pindaiba-ea60b1b08015060a08b1ead38e4e81c44a88017f.tar.xz
Move unit tests out of src/*.c into tests/
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile92
1 files changed, 44 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index 02b9166..57d93fa 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ LDLIBS = -lsiphash
.SUFFIXES:
-.SUFFIXES: .in .c .o .to .a .bin .msg .cat .bin-check
+.SUFFIXES: .in .c .o .a .bin .msg .cat .bin-check
.in:
sed \
@@ -33,10 +33,7 @@ LDLIBS = -lsiphash
if [ -x $< ]; then chmod +x $@; fi
.c.o:
- $(CC) $(CFLAGS) -o $@ -c $<
-
-.c.to:
- $(CC) $(CFLAGS) -DTEST -o $@ -c $<
+ $(CC) $(CFLAGS) -o $@ -c $<
.a.bin:
$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
@@ -51,49 +48,49 @@ catalogs.cat = $(catalogs.msg:.msg=.cat)
sources.h = $(sources.c:.c=.h)
sources.o = $(sources.c:.c=.o)
-sources.to = $(sources.c:.c=.to)
-sources.a = $(sources.c:.c=.a)
-sources.bin = $(sources.c:.c=.bin)
+tests.o = $(tests.c:.c=.o)
+tests.a = $(tests.c:.c=.a)
+tests.bin = $(tests.c:.c=.bin)
fuzz.o = $(fuzz.c:.c=.o)
fuzz.a = $(fuzz.c:.c=.a)
fuzz.bin = $(fuzz.c:.c=.bin)
archives = \
- lib$(NAME).a \
- $(sources.a) \
- src/main.a \
- $(fuzz.a) \
+ lib$(NAME).a \
+ $(tests.a) \
+ $(NAME).a \
+ $(fuzz.a) \
sources = \
- $(sources.c) \
- $(sources.h) \
- src/config.h.in \
- src/config.h \
- src/main.c \
- src/$(NAME).h \
- $(catalogs.msg) \
+ $(sources.c) \
+ $(sources.h) \
+ src/config.h.in \
+ src/config.h \
+ src/main.c \
+ src/$(NAME).h \
+ $(catalogs.msg) \
derived-assets = \
- lib$(NAME).a \
- src/config.h \
- $(manpages) \
- $(catalogs.cat) \
- $(sources.o) \
- $(sources.to) \
- $(sources.a) \
- $(sources.bin) \
- tests/slurp.o \
- src/main.o \
- src/main.a \
- src/main.bin \
+ lib$(NAME).a \
+ src/config.h \
+ $(manpages) \
+ $(catalogs.cat) \
+ $(sources.o) \
+ $(tests.o) \
+ $(tests.a) \
+ $(tests.bin) \
+ tests/slurp.o \
+ src/main.o \
+ $(NAME).a \
+ $(NAME).bin \
side-assets = \
- $(fuzz.o) \
- $(fuzz.a) \
- $(fuzz.bin) \
- src/logerr.c.txt \
- src/catalog.c.txt \
+ $(fuzz.o) \
+ $(fuzz.a) \
+ $(fuzz.bin) \
+ tests/logerr.c.txt \
+ tests/catalog.c.txt \
@@ -103,31 +100,30 @@ all: $(derived-assets)
lib$(NAME).a: $(sources.o)
-src/main.a: $(sources.o) src/main.o
+$(NAME).a: $(sources.o) src/main.o
$(fuzz.bin): lib$(NAME).a
-$(manpages) src/config.h: Makefile deps.mk
-$(sources.o) $(sources.to): Makefile deps.mk src/config.h
-tests/slurp.o: Makefile deps.mk src/config.h
+$(manpages) src/config.h: Makefile deps.mk
+$(sources.o) $(tests.o): Makefile deps.mk src/config.h
+src/main.o tests/slurp.o: Makefile deps.mk src/config.h
+tests/slurp.o: tests/slurp.h
$(archives):
$(AR) $(ARFLAGS) $@ $?
-src/catalog.bin-check: src/$(NAME).en.cat
-src/$(NAME).en.cat: src/i18n.bin
- env DUMP_TRANSLATABLE_STRINGS=1 $(EXEC)src/i18n.bin > $*.msg.new
- cmp -s $*.msg.new $*.msg || mv $*.msg.new $*.msg
- rm -f $*.msg.new
+tests/catalog.bin-check: src/$(NAME).en.cat
+src/$(NAME).en.cat: tests/i18n.bin
+ env DUMP_TRANSLATABLE_STRINGS=1 $(EXEC)tests/i18n.bin | ifnew $*.msg
gencat $@ $*.msg
touch $@
-sources.bin-check = $(sources.c:.c=.bin-check)
-$(sources.bin-check):
+tests.bin-check = $(tests.c:.c=.bin-check)
+$(tests.bin-check):
$(EXEC)$*.bin
-check-unit: $(sources.bin-check)
+check-unit: $(tests.bin-check)
## Run all tests. Each test suite is isolated, so that a parallel