2013-05-24 20:29:02 +00:00
|
|
|
CC = g++
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
# Requirements: cpputest.github.io
|
2013-05-24 20:29:02 +00:00
|
|
|
|
|
|
|
BTSTACK_ROOT = ../..
|
|
|
|
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
|
|
|
|
|
2015-11-13 15:04:41 +01:00
|
|
|
CFLAGS = -g -Wall -I.. -I${BTSTACK_ROOT}/src
|
2015-05-17 18:07:24 +02:00
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
|
|
|
|
2015-11-13 15:04:41 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/classic
|
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
|
2013-05-24 20:29:02 +00:00
|
|
|
|
|
|
|
COMMON = \
|
2015-05-17 18:07:24 +02:00
|
|
|
sdp_util.c \
|
2016-02-17 20:21:21 +01:00
|
|
|
sdp_client.c \
|
2016-03-28 12:04:29 +02:00
|
|
|
spp_server.c \
|
2016-02-17 20:21:21 +01:00
|
|
|
mock.c \
|
2015-10-11 23:31:11 +02:00
|
|
|
hci_dump.c \
|
2016-01-20 16:10:07 +01:00
|
|
|
btstack_util.c \
|
2013-05-24 20:29:02 +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
|
2013-05-24 20:29:02 +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
|
|
|
|
|
|
|
|
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
|
|
|
|
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
|
|
|
|
|
|
|
|
all: $(addprefix build-coverage/, sdp_rfcomm_query general_sdp_query service_attribute_search_query service_search_query) \
|
|
|
|
$(addprefix build-asan/, sdp_rfcomm_query general_sdp_query service_attribute_search_query service_search_query)
|
2020-11-30 21:35:42 +01: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 $@
|
|
|
|
|
|
|
|
build-asan/%.o: %.c | build-asan
|
|
|
|
${CC} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
|
|
|
|
|
|
|
build-coverage/sdp_rfcomm_query: ${COMMON_OBJ_COVERAGE} build-coverage/sdp_client_rfcomm.o build-coverage/sdp_rfcomm_query.o build-coverage/btstack_linked_list.o | build-coverage
|
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
|
|
|
|
|
|
|
build-coverage/general_sdp_query: ${COMMON_OBJ_COVERAGE} build-coverage/general_sdp_query.o build-coverage/btstack_linked_list.o | build-coverage
|
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
|
|
|
|
|
|
|
build-coverage/service_attribute_search_query: ${COMMON_OBJ_COVERAGE} build-coverage/service_attribute_search_query.o build-coverage/btstack_linked_list.o | build-coverage
|
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
|
|
|
|
|
|
|
build-coverage/service_search_query: ${COMMON_OBJ_COVERAGE} build-coverage/service_search_query.o build-coverage/btstack_linked_list.o | build-coverage
|
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
2020-11-30 21:35:42 +01:00
|
|
|
|
2013-06-10 21:05:53 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/sdp_rfcomm_query: ${COMMON_OBJ_ASAN} build-asan/sdp_client_rfcomm.o build-asan/sdp_rfcomm_query.o build-asan/btstack_linked_list.o | build-asan
|
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
2013-05-24 20:29:02 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/general_sdp_query: ${COMMON_OBJ_ASAN} build-asan/general_sdp_query.o build-asan/btstack_linked_list.o | build-asan
|
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
|
|
|
|
|
|
|
build-asan/service_attribute_search_query: ${COMMON_OBJ_ASAN} build-asan/service_attribute_search_query.o build-asan/btstack_linked_list.o | build-asan
|
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
|
|
|
|
|
|
|
build-asan/service_search_query: ${COMMON_OBJ_ASAN} build-asan/service_search_query.o build-asan/btstack_linked_list.o | build-asan
|
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
2013-11-01 13:12:53 +00:00
|
|
|
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
test: all
|
2020-12-01 22:13:09 +01:00
|
|
|
ASAN_OPTIONS=detect_leaks=0 build-asan/sdp_rfcomm_query
|
|
|
|
build-asan/general_sdp_query
|
|
|
|
build-asan/service_attribute_search_query
|
|
|
|
build-asan/service_search_query
|
|
|
|
|
|
|
|
coverage: all
|
|
|
|
rm -f build-coverage/*.gcda
|
2020-11-30 21:35:42 +01:00
|
|
|
ASAN_OPTIONS=detect_leaks=0 build-coverage/sdp_rfcomm_query
|
|
|
|
build-coverage/general_sdp_query
|
|
|
|
build-coverage/service_attribute_search_query
|
|
|
|
build-coverage/service_search_query
|
2019-09-17 15:11:58 +02:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
clean:
|
|
|
|
rm -rf build-coverage build-asan
|