aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-01-07 23:40:55 +0100
committerMattias Andrée <maandree@kth.se>2023-01-07 23:40:55 +0100
commit4a7c500000af251d55919b7462599a67fc76c5bc (patch)
tree467c177dd2db091bd2789845859d9e8837c977a6 /Makefile
parentAdd textual descriptions of subpixel layouts (diff)
downloadlibfonts-4a7c500000af251d55919b7462599a67fc76c5bc.tar.gz
libfonts-4a7c500000af251d55919b7462599a67fc76c5bc.tar.bz2
libfonts-4a7c500000af251d55919b7462599a67fc76c5bc.tar.xz
Add tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
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