2015-07-03 09:18:03 +00:00
|
|
|
# Requirements: cpputest.github.io
|
2014-06-16 20:55:54 +00:00
|
|
|
|
|
|
|
BTSTACK_ROOT = ../..
|
2023-08-20 14:13:49 +00:00
|
|
|
# CppuTest from pkg-config
|
|
|
|
CFLAGS += ${shell pkg-config --cflags CppuTest}
|
|
|
|
LDFLAGS += ${shell pkg-config --libs CppuTest}
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2023-08-20 14:13:49 +00:00
|
|
|
CFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null -Ibuild-coverage -I./
|
2021-06-12 10:03:02 +00:00
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/src
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/include
|
|
|
|
CFLAGS += -I..
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2015-11-13 14:04:41 +00:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/ble
|
2015-05-17 16:07:24 +00:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src
|
2016-01-20 13:20:47 +00:00
|
|
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2015-05-17 16:07:24 +00:00
|
|
|
COMMON = \
|
2016-01-20 13:34:04 +00:00
|
|
|
btstack_linked_list.c \
|
2017-11-17 17:04:16 +00:00
|
|
|
hci_dump.c \
|
|
|
|
btstack_util.c \
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
|
2021-01-29 20:47:15 +00:00
|
|
|
CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
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 21:13:09 +00: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 21:13:09 +00:00
|
|
|
build-%:
|
|
|
|
mkdir -p $@
|
2020-11-30 20:35:42 +00:00
|
|
|
|
|
|
|
build-coverage/%.o: %.c | build-coverage
|
2020-12-01 21:13:09 +00:00
|
|
|
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
|
2020-11-30 20:35:42 +00:00
|
|
|
|
2022-03-11 21:15:38 +00:00
|
|
|
build-coverage/%.o: %.cpp | build-coverage
|
|
|
|
${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
|
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-asan/%.o: %.c | build-asan
|
|
|
|
${CC} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
2022-03-11 21:15:38 +00:00
|
|
|
build-asan/%.o: %.cpp | build-asan
|
|
|
|
${CXX} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-coverage/btstack_linked_list_test: ${COMMON_OBJ_COVERAGE} build-coverage/btstack_linked_list_test.o | build-coverage
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
build-asan/btstack_linked_list_test: ${COMMON_OBJ_ASAN} build-asan/btstack_linked_list_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2014-06-16 20:55:54 +00:00
|
|
|
|
2015-07-03 09:18:03 +00:00
|
|
|
test: all
|
2020-12-01 21:13:09 +00:00
|
|
|
build-asan/btstack_linked_list_test
|
2015-05-17 16:07:24 +00:00
|
|
|
|
2020-11-30 20:35:42 +00:00
|
|
|
coverage: all
|
2020-12-01 21:13:09 +00:00
|
|
|
rm -f build-coverage/*.gcda
|
2020-11-30 20:35:42 +00:00
|
|
|
build-coverage/btstack_linked_list_test
|
|
|
|
|
2014-06-16 20:55:54 +00:00
|
|
|
clean:
|
2020-12-01 21:13:09 +00:00
|
|
|
rm -rf build-coverage build-asan
|