From b6bb688199abc342a6e85f80859c8cbb5a41b58a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 23 Jan 2023 20:34:03 +0100 Subject: Add some tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8ae2b95..d031557 100644 --- a/Makefile +++ b/Makefile @@ -44,9 +44,10 @@ HDR =\ libglitter.h LOBJ = $(OBJ:.o=.lo) +TESTS = $(OBJ:.o=.test) -all: libglitter.a libglitter.$(LIBEXT) +all: libglitter.a libglitter.$(LIBEXT) $(TESTS) $(OBJ): $(HDR) $(LOBJ): $(HDR) libglitter_compose_float.o: libglitter_compose_double.c @@ -57,6 +58,7 @@ libglitter_compose_uint8.o: libglitter_compose_uint64.c libglitter_compose_doubl libglitter_desaturate_float.o: libglitter_desaturate_double.c libglitter_per_channel_desaturate_float.o: libglitter_per_channel_desaturate_double.c libglitter_split_uint32_raster.o: libglitter_split_uint64_raster.c +$(TESTS): $(HDR) libglitter.a .c.o: $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) @@ -64,6 +66,9 @@ libglitter_split_uint32_raster.o: libglitter_split_uint64_raster.c .c.lo: $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) +.c.test: + $(CC) -o $@ $< libglitter.a $(CFLAGS) $(CPPFLAGS) -DTEST $(LDFLAGS) + libglitter.a: $(OBJ) @rm -f -- $@ $(AR) rc $@ $(OBJ) @@ -72,6 +77,9 @@ libglitter.a: $(OBJ) libglitter.$(LIBEXT): $(LOBJ) $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) +check: $(TESTS) + @for t in $(TESTS); do printf './%s\n' $$t; ./$$t || exit 1; done + install: libglitter.a libglitter.$(LIBEXT) mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" mkdir -p -- "$(DESTDIR)$(PREFIX)/include" @@ -90,10 +98,10 @@ uninstall: -rm -f -- "$(DESTDIR)$(PREFIX)/include/libglitter.h" clean: - -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib + -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib *.test -rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT) .SUFFIXES: -.SUFFIXES: .lo .o .c +.SUFFIXES: .lo .o .c .test -.PHONY: all install uninstall clean +.PHONY: all check install uninstall clean -- cgit v1.2.3-70-g09d2