-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (29 loc) · 861 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
LIB_NAME=qlist
STATICLIB_NAME=lib${LIB_NAME}.a
CFLAGS=-g -O3 -Wall -I${LIB_NAME} -Isrc ${OPTS}
SRC=$(wildcard src/*.c )
OBJ=$(patsubst %.c,%.o,${SRC})
LIB_OBJ=${OBJ}
TEST_SRC=$(wildcard test/*_test.c)
TESTS=$(patsubst %.c,%,${TEST_SRC})
TEST_HELPER_SRC=$(wildcard test/helpers/*.c)
TEST_HELPER_OBJ=$(patsubst %.c,%.o,${TEST_HELPER_SRC})
all: ${STATICLIB_NAME} $(TESTS)
debug: CFLAGS+=-DDEBUG
debug: all
${STATICLIB_NAME}: ${LIB_OBJ}
ar rvs $@ ${LIB_OBJ}
ranlib $@
clean:
rm -rf ${STATICLIB_NAME}
rm -rf ${OBJ}
rm -rf ${TEST_HELPER_OBJ}
rm -rf ${TESTS}
rm -rf test/*.dSYM
rm -rf tmp/*
${TESTS}: %: %.c ${STATICLIB_NAME} ${TEST_HELPER_OBJ}
$(CC) $(CFLAGS) -Itest -o $@ $< ${STATICLIB_NAME} ${TEST_HELPER_OBJ}
tests: all ${TESTS}
sh test/runtests.sh
memcheck: all ${TESTS}
valgrind --leak-check=full --show-reachable=no ./test/function_test