2014-06-16 20:55:54 +00:00
|
|
|
CC=g++
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
# Requirements: cpputest.github.io
|
2014-06-16 20:55:54 +00:00
|
|
|
|
|
|
|
BTSTACK_ROOT = ../..
|
|
|
|
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
CFLAGS = -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2015-11-13 15:04:41 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/ble
|
2015-05-17 18:07:24 +02:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src
|
2016-01-20 14:20:47 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2015-05-17 18:07:24 +02:00
|
|
|
COMMON = \
|
2016-01-20 14:34:04 +01:00
|
|
|
btstack_linked_list.c \
|
2017-11-17 18:04:16 +01:00
|
|
|
hci_dump.c \
|
|
|
|
btstack_util.c \
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
|
|
|
|
CFLAGS_ASAN = ${CFLAGS} -fsanitize=address
|
|
|
|
|
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
|
|
|
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
|
|
|
|
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
|
|
|
|
|
|
|
|
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
|
|
|
|
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
all: build-coverage/btstack_linked_list_test build-asan/btstack_linked_list_test
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
build-%:
|
|
|
|
mkdir -p $@
|
2020-11-30 21:35:42 +01:00
|
|
|
|
|
|
|
build-coverage/%.o: %.c | build-coverage
|
2020-12-01 22:13:09 +01:00
|
|
|
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
|
2020-11-30 21:35:42 +01:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/%.o: %.c | build-asan
|
|
|
|
${CC} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
|
|
|
build-coverage/btstack_linked_list_test: ${COMMON_OBJ_COVERAGE} build-coverage/btstack_linked_list_test.o | build-coverage
|
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
|
|
|
|
|
|
|
build-asan/btstack_linked_list_test: ${COMMON_OBJ_ASAN} build-asan/btstack_linked_list_test.o | build-asan
|
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
test: all
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/btstack_linked_list_test
|
2015-05-17 18:07:24 +02:00
|
|
|
|
2020-11-30 21:35:42 +01:00
|
|
|
coverage: all
|
2020-12-01 22:13:09 +01:00
|
|
|
rm -f build-coverage/*.gcda
|
2020-11-30 21:35:42 +01:00
|
|
|
build-coverage/btstack_linked_list_test
|
|
|
|
|
2014-06-16 20:55:54 +00:00
|
|
|
clean:
|
2020-12-01 22:13:09 +01:00
|
|
|
rm -rf build-coverage build-asan
|