forked from gkdr/libomemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
68 lines (54 loc) · 2.37 KB
/
makefile
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
68
SDIR = src
BDIR = build
TDIR = test
LDIR = lib
# according to https://sourceware.org/bugzilla/show_bug.cgi?id=17879
# -fno-builtin-memset is enough to make gcc not optimize it away
FILES =
CFLAGS =-std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -fno-builtin-memset `pkg-config --cflags glib-2.0`
CFLAGS_CONVERSATIONS=$(CFLAGS) -DOMEMO_XMLNS='"eu.siacs.conversations.axolotl"' -DOMEMO_NS_SEPARATOR='"."' -DOMEMO_NS_NOVERSION
COVFLAGS = --coverage -O0 -g $(CFLAGS)
LFLAGS = -lmxml -pthread -ldl -lm -lcrypto `pkg-config --libs glib-2.0` -lsqlite3
TESTFLAGS = -lcmocka $(LFLAGS)
all: libomemo-conversations
$(BDIR):
mkdir -p $@
libomemo: $(SDIR)/libomemo.c libomemo_crypto libomemo_storage $(BDIR)
libtool --mode=compile gcc -c $(SDIR)/$@.c $(CFLAGS) -o $(BDIR)/$@.lo
libtool --mode=link gcc -o $(BDIR)/$@.la $(BDIR)/$@.lo $(BDIR)/$@_crypto.lo $(BDIR)/$@_storage.lo
libomemo-conversations: $(SDIR)/libomemo.c libomemo_crypto libomemo_storage $(BDIR)
libtool --mode=compile gcc -c $(SDIR)/libomemo.c $(CFLAGS_CONVERSATIONS) -o $(BDIR)/libomemo.lo
libtool --mode=link gcc -o $(BDIR)/libomemo.la $(BDIR)/libomemo.lo $(BDIR)/libomemo_crypto.lo $(BDIR)/libomemo_storage.lo
libomemo_crypto: $(SDIR)/libomemo_crypto.c build
libtool --mode=compile gcc -c $(SDIR)/$@.c $(CFLAGS) -o $(BDIR)/$@.lo
libomemo_storage: $(SDIR)/libomemo_storage.c build
libtool --mode=compile gcc -c $(SDIR)/$@.c $(CFLAGS) -o $(BDIR)/$@.lo
$(BDIR)/libomemo.o: $(BDIR) $(SDIR)/libomemo.c $(SDIR)/libomemo.h
gcc -c $(CFLAGS) $(SDIR)/libomemo.c -o $@
.PHONY = test_libomemo.o
test_libomemo: $(TDIR)/test_libomemo.c $(SDIR)/libomemo.c
gcc $(COVFLAGS) $< $(FILES) -o $(TDIR)/$@.o $(TESTFLAGS)
-$(TDIR)/$@.o
mv *.g* $(TDIR)
.PHONY: test_crypto
test_crypto: $(TDIR)/test_crypto.c $(SDIR)/libomemo_crypto.c
gcc $(COVFLAGS) $< $(FILES) -o $(TDIR)/$@.o $(TESTFLAGS)
-$(TDIR)/$@.o
mv *.g* $(TDIR)
.PHONY: test_storage
test_storage: $(TDIR)/test_storage.c $(SDIR)/libomemo_storage.c
gcc $(COVFLAGS) $< $(FILES) -o $(TDIR)/$@.o $(TESTFLAGS)
-$(TDIR)/$@.o
mv *.g* $(TDIR)
.PHONY: test
test : test_libomemo test_crypto test_storage
.PHONY: coverage
coverage: test
gcovr -r . --html --html-details -o $@.html
gcovr -r . -s
mkdir -p $@
mv $@.* $@
.PHONY: clean
clean:
rm -rf build coverage
rm -f $(TDIR)/*.sqlite $(TDIR)/*.o $(TDIR)/*.gcno $(TDIR)/*.gcda