From 4a7c500000af251d55919b7462599a67fc76c5bc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 7 Jan 2023 23:40:55 +0100 Subject: Add tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9ff12b7..016ca67 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,10 @@ OBJ =\ libfonts_get_subpixel_order_class.o\ libfonts_unget_subpixel_order_class.o +TESTS =\ + libfonts_get_subpixel_order_class.test\ + libfonts_unget_subpixel_order_class.test + HDR =\ common.h\ libfonts.h @@ -32,9 +36,10 @@ HDR =\ LOBJ = $(OBJ:.o=.lo) -all: libfonts.a libfonts.$(LIBEXT) +all: libfonts.a libfonts.$(LIBEXT) $(TESTS) $(OBJ): $(HDR) $(LOBJ): $(HDR) +$(TESTS): $(HDR) libfonts.a .c.o: $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) @@ -42,6 +47,9 @@ $(LOBJ): $(HDR) .c.lo: $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) +.c.test: + $(CC) -o $@ $< libfonts.a $(CFLAGS) $(CPPFLAGS) -DTEST $(LDFLAGS) + libfonts.a: $(OBJ) @rm -f -- $@ $(AR) rc $@ $(OBJ) @@ -50,6 +58,9 @@ libfonts.a: $(OBJ) libfonts.$(LIBEXT): $(LOBJ) $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) +check: $(TESTS) + @for t in $(TESTS); do printf './%s\n' $$t; ./$$t || exit 1; done + install: libfonts.a libfonts.$(LIBEXT) mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" mkdir -p -- "$(DESTDIR)$(PREFIX)/include" @@ -68,10 +79,10 @@ uninstall: -rm -f -- "$(DESTDIR)$(PREFIX)/include/libfonts.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 -- cgit v1.2.3-70-g09d2