2017-06-03 22:45:55 +00:00
|
|
|
BTSTACK_ROOT = ../..
|
|
|
|
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
COMMON = \
|
|
|
|
btstack_tlv_flash_bank.c \
|
|
|
|
btstack_util.c \
|
|
|
|
hal_flash_bank_memory.c \
|
|
|
|
hci_dump.c \
|
2021-03-10 13:50:44 +00:00
|
|
|
hci_dump_posix_fs.c \
|
2017-06-03 22:45:55 +00:00
|
|
|
|
|
|
|
VPATH = \
|
2017-06-05 09:52:35 +00:00
|
|
|
${BTSTACK_ROOT}/src \
|
|
|
|
${BTSTACK_ROOT}/src/classic \
|
2017-08-11 14:34:10 +00:00
|
|
|
${BTSTACK_ROOT}/src/ble \
|
2017-06-05 09:52:35 +00:00
|
|
|
${BTSTACK_ROOT}/platform/embedded \
|
2021-03-10 13:50:44 +00:00
|
|
|
${BTSTACK_ROOT}/platform/posix \
|
2017-06-03 22:45:55 +00:00
|
|
|
|
2022-03-11 21:15:38 +00:00
|
|
|
CFLAGS = -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null
|
2021-06-12 10:03:02 +00:00
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/src
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/platform/embedded
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/platform/posix
|
|
|
|
CFLAGS += -I..
|
2017-06-03 22:45:55 +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
|
|
|
|
2017-06-03 22:45:55 +00:00
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
2020-12-01 21:13:09 +00:00
|
|
|
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
|
|
|
|
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
|
2017-06-03 22:45:55 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
|
|
|
|
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
|
2017-06-03 22:45:55 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
all: build-coverage/tlv_test build-asan/tlv_test
|
2017-06-03 22:45:55 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-%:
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
build-coverage/%.o: %.c | build-coverage
|
|
|
|
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
|
|
|
|
|
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 $@
|
2017-06-03 22:45:55 +00:00
|
|
|
|
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/tlv_test: ${COMMON_OBJ_COVERAGE} build-coverage/btstack_link_key_db_tlv.o build-coverage/tlv_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/tlv_test: ${COMMON_OBJ_ASAN} build-asan/btstack_link_key_db_tlv.o build-asan/tlv_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2017-08-11 14:34:10 +00:00
|
|
|
|
2017-06-03 22:45:55 +00:00
|
|
|
test: all
|
2020-12-01 21:13:09 +00:00
|
|
|
build-asan/tlv_test
|
2017-06-03 22:45:55 +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/tlv_test
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf build-coverage build-asan
|