summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 953282689347cbe674f85f639ee166732baeb54a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

LANG =\
	swedish

OBJ =\
	libnumtext_num2text.o\
	libnumtext_remove_separators.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)

.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"
	cp -- libnumtext.a "$(DESTDIR)$(PREFIX)/lib/"
	cp -- libnumtext.h "$(DESTDIR)$(PREFIX)/include/"

uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libnumtext.a"
	-rm -f -- "$(DESTDIR)$(PREFIX)/include/libnumtext.h"

clean:
	-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda

.SUFFIXES:
.SUFFIXES: .lo .o .c .test .test.o

.PHONY: all check install uninstall clean