-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
44 lines (32 loc) · 963 Bytes
/
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
CC=gcc
DEBUG=-g -gdwarf-3
WARN=-Wno-shift-negative-value -Wall -Wextra -Wpointer-arith -Wunused
OP=-O3 -march=native -mtune=native -funroll-loops -m64
TST=--coverage -p
RM=rm -f
SRC=bitbuf.c
TRASH=*.o *.out *.gc*
.PHONY: bitbuf.o
all: libbitbuf.a
libbitbuf.a: format bitbuf.o
ar -rcus libbitbuf.a bitbuf.o
test:
$(CC) $(WARN) bitbuf_test.c bitbuf.c -o bb_test
./bb_test
ptest:
$(CC) $(WARN) $(DEBUG) $(TST) bitbuf_test.c bitbuf.c -o bb_test
./bb_test
valgrind: test
valgrind --leak-check=full --error-exitcode=42 ./bb_test
stat:
@make ptest >/dev/null
@command -v gcov >/dev/null 2>&1 || { echo >&2 "No gcov: skipping coverage test"; exit 1; }
@command -v gprof >/dev/null 2>&1 || { echo >&2 "No gprof: skipping performance test"; exit 1; }
gcov bitbuf.c
gprof bb_test > profile.txt
format:
clang-format -i --style=Google bitbuf.[ch] bitbuf_test.c
bitbuf.o: bitbuf.h bitbuf.c
$(CC) $(WARN) $(OP) -fPIC -c bitbuf.c
clean:
$(RM) $(TRASH)