2014-04-10 12:52:42 +00:00
|
|
|
CC = g++
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
# Requirements: cpputest.github.io
|
2014-04-10 12:52:42 +00:00
|
|
|
|
|
|
|
BTSTACK_ROOT = ../..
|
|
|
|
|
2020-11-30 21:35:42 +01:00
|
|
|
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null -I. -Ibuild-coverage -I${BTSTACK_ROOT}/src
|
2014-04-10 12:52:42 +00:00
|
|
|
|
2015-05-14 08:25:34 +02:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src
|
2015-11-13 15:04:41 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/ble
|
2021-03-08 10:09:41 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service
|
2016-01-20 14:20:47 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
2015-05-14 08:25:34 +02:00
|
|
|
|
2014-04-10 12:52:42 +00:00
|
|
|
COMMON = \
|
2019-09-17 15:11:58 +02:00
|
|
|
ad_parser.c \
|
2019-09-23 11:07:26 +02:00
|
|
|
ancs_client.c \
|
2019-09-17 15:11:58 +02:00
|
|
|
att_db.c \
|
|
|
|
att_dispatch.c \
|
|
|
|
btstack_linked_list.c \
|
|
|
|
btstack_memory.c \
|
|
|
|
btstack_memory_pool.c \
|
|
|
|
btstack_util.c \
|
|
|
|
gatt_client.c \
|
|
|
|
hci_cmd.c \
|
|
|
|
hci_dump.c \
|
|
|
|
le_device_db_memory.c \
|
|
|
|
mock.c \
|
2014-05-02 12:08:22 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
|
2021-01-29 21:47:15 +01:00
|
|
|
CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
|
2014-04-10 12:52:42 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
|
|
|
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
|
|
|
|
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
|
2020-11-30 21:35:42 +01:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
|
|
|
|
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
|
|
|
|
|
|
|
|
all: build-coverage/gatt_client_test build-coverage/le_central build-asan/gatt_client_test build-asan/le_central
|
|
|
|
|
|
|
|
build-%:
|
|
|
|
mkdir -p $@
|
2014-04-10 12:52:42 +00:00
|
|
|
|
2014-04-11 08:50:07 +00:00
|
|
|
# compile .ble description
|
2020-12-01 22:13:09 +01:00
|
|
|
build-%/profile.h: profile.gatt | build-%
|
2020-09-25 13:25:22 +02:00
|
|
|
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
|
2014-04-11 08:50:07 +00:00
|
|
|
|
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 $@
|
|
|
|
|
|
|
|
build-asan/%.o: %.c | build-asan
|
|
|
|
${CC} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
|
|
|
build-coverage/gatt_client_test: ${COMMON_OBJ_COVERAGE} build-coverage/profile.h build-coverage/gatt_client_test.o expected_results.h | build-coverage
|
|
|
|
${CC} $(filter-out build-coverage/profile.h expected_results.h,$^) ${LDFLAGS_COVERAGE} -o $@
|
2020-11-30 21:35:42 +01:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
build-coverage/le_central: ${COMMON_OBJ_COVERAGE} build-coverage/le_central.o | build-coverage
|
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
2014-04-10 12:52:42 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/gatt_client_test: ${COMMON_OBJ_ASAN} build-asan/profile.h build-asan/gatt_client_test.o expected_results.h | build-asan
|
|
|
|
${CC} $(filter-out build-asan/profile.h expected_results.h,$^) ${LDFLAGS_ASAN} -o $@
|
|
|
|
|
|
|
|
build-asan/le_central: ${COMMON_OBJ_ASAN} build-asan/le_central.o | build-asan
|
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
2014-04-28 21:09:35 +00:00
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
test: all
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/gatt_client_test
|
|
|
|
build-asan/le_central
|
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/gatt_client_test
|
|
|
|
build-coverage/le_central
|
|
|
|
|
2014-04-10 12:52:42 +00:00
|
|
|
clean:
|
2020-12-01 22:13:09 +01:00
|
|
|
rm -rf build-coverage build-asan
|
2019-09-17 15:11:58 +02:00
|
|
|
|