summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-05 14:53:47 +0200
committerMattias Andrée <maandree@kth.se>2021-09-05 14:53:47 +0200
commita97da13a7c3716f985973f0454f5c8caa0fa05b1 (patch)
tree41096cd7f389b916c0c77df0432f4f00ddb327c9 /Makefile
parentFirst commit (diff)
downloadlibnumtext-a97da13a7c3716f985973f0454f5c8caa0fa05b1.tar.gz
libnumtext-a97da13a7c3716f985973f0454f5c8caa0fa05b1.tar.bz2
libnumtext-a97da13a7c3716f985973f0454f5c8caa0fa05b1.tar.xz
Add tests for and fix Swedish
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 25 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 796d0cf..9532826 100644
--- a/Makefile
+++ b/Makefile
@@ -3,18 +3,30 @@
CONFIGFILE = config.mk
include $(CONFIGFILE)
+LANG =\
+ swedish
+
OBJ =\
libnumtext_num2text.o\
libnumtext_remove_separators.o\
- swedish.o
+ $(LANG:=.o)
HDR =\
libnumtext.h\
common.h
+TEST =\
+ $(LANG:=.test)
+
+TEST_OBJ =\
+ $(TEST:=.o)
+
+
all: libnumtext.a
$(OBJ): $(HDR)
$(OBJ:.o=.lo): $(HDR)
+$(TEST_OBJ): libnumtext.h
+$(TEST): libnumtext.a
.c.o:
$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
@@ -22,10 +34,20 @@ $(OBJ:.o=.lo): $(HDR)
.c.lo:
$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+.test.o.test:
+ $(CC) -o $@ $< libnumtext.a $(LDFLAGS)
+
libnumtext.a: $(OBJ)
@rm -f -- $@
$(AR) rc $@ $(OBJ)
+check: $(TEST)
+ @set -e &&\
+ for t in $(TEST); do\
+ printf './%s\n' "$$t";\
+ "./$$t" || exit 1;\
+ done
+
install: libnumtext.a
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
@@ -40,6 +62,6 @@ clean:
-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda
.SUFFIXES:
-.SUFFIXES: .lo .o .c
+.SUFFIXES: .lo .o .c .test .test.o
-.PHONY: all install uninstall clean
+.PHONY: all check install uninstall clean