-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
48 lines (38 loc) · 1.17 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
CC := gcc
CFLAGS := -std=c11 -Wall -Werror -Wextra -pedantic -g
all: dist/libtiny.so dist/libtiny-override.so dist/tiny.o dist/tiny-override.o
dist/libtiny.so: tiny.c tiny.h
mkdir -p dist
$(CC) -o dist/libtiny.so tiny.c \
-DTINY_BUFFER=4000 \
-shared -fpic \
-fprofile-arcs -ftest-coverage \
$(CFLAGS)
dist/tiny.o: tiny.c tiny.h
mkdir -p dist
$(CC) -c -o dist/tiny.o tiny.c $(CFLAGS)
dist/libtiny-override.so: tiny-override.c tiny.c tiny.h
mkdir -p dist
$(CC) -o dist/libtiny-override.so tiny-override.c tiny.c \
-DTINY_BUFFER=4000 \
-shared -fpic \
$(CFLAGS)
dist/tiny-override.o: tiny-override.c tiny.h
mkdir -p dist
$(CC) -c -o dist/tiny-override.o tiny-override.c \
-DTINY_BUFFER=4000 \
$(CFLAGS)
dist/test: test/test.c test/helpers.h dist/libtiny.so
mkdir -p dist
$(CC) -o dist/test test/*.c -I. -Itest -Ldist -ltiny $(CFLAGS) -Wno-unused-parameter
.PHONY: clean test coverage
clean:
rm -rf dist coverage
test: dist/test
LD_LIBRARY_PATH=./dist dist/test
coverage: dist/test
mkdir -p coverage
LD_LIBRARY_PATH=./dist dist/test
gcov test/test.c
lcov -c --directory . --output-file coverage/test.info
genhtml coverage/test.info --output-directory coverage