aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
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