aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-01-23 20:34:03 +0100
committerMattias Andrée <maandree@kth.se>2023-01-23 20:34:03 +0100
commitb6bb688199abc342a6e85f80859c8cbb5a41b58a (patch)
tree46d953c3689f5f75210c7667c3a4f1c4d1386aab /Makefile
parentAdd libglitter_reorder_rasters (diff)
downloadlibglitter-b6bb688199abc342a6e85f80859c8cbb5a41b58a.tar.gz
libglitter-b6bb688199abc342a6e85f80859c8cbb5a41b58a.tar.bz2
libglitter-b6bb688199abc342a6e85f80859c8cbb5a41b58a.tar.xz
Add some tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile16
1 files changed, 12 insertions, 4 deletions
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