diff options
author | Mattias Andrée <maandree@kth.se> | 2018-08-18 23:40:11 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-08-18 23:40:11 +0200 |
commit | 3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba (patch) | |
tree | a00b8ec51cfaf110d8bf36daa91827c95dc107e7 /Makefile | |
parent | Improve makefile (diff) | |
download | libsimple-3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba.tar.gz libsimple-3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba.tar.bz2 libsimple-3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba.tar.xz |
Fix and run tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 39 |
1 files changed, 35 insertions, 4 deletions
@@ -54,17 +54,48 @@ OBJ =\ vweprintf.o\ libsimple.o -all: libsimple.a +TESTS =\ + asprintf.test\ + isutf8.test\ + memdup.test\ + memends.test\ + memmem.test\ + memrchr.test\ + memrmem.test\ + memstarts.test\ + rawmemchr.test\ + rawmemrchr.test\ + strcaseends.test\ + strcasestr.test\ + strends.test\ + strndup.test\ + strrcasestr.test\ + strrstr.test\ + strstarts.test\ + vasprintf.test + +all: libsimple.a $(TESTS) $(OBJ): $(@:.o=.c) libsimple.h +$(TESTS): $(@:=.o) libsimple.a +$(TESTS:=.o): $(@:.test.o=.c) libsimple.h test.h libsimple.a: $(OBJ) $(AR) rc $@ $? $(AR) -s $@ +.test.o.test: + $(CC) -o $@ $< libsimple.a $(LDFLAGS) + +.c.test.o: + $(CC) -c -o $@ $< $(CFLAGS) -DTEST + +check: $(TESTS) + @set -e; for t in $(TESTS); do printf '%s\n' "./$$t"; "./$$t"; done + clean: - -rm -rf -- *.o *.su *.a *.so *.so.* *.gch *.gcda *.gcno *.gcov *.lo + -rm -rf -- *.o *.su *.a *.so *.so.* *.gch *.gcda *.gcno *.gcov *.lo *.test .SUFFIXES: -.SUFFIXES: .o .c +.SUFFIXES: .test .test.o .o .c -.PHONY: all clean +.PHONY: all check clean |