1CC = g++ 2 3# Requirements: cpputest.github.io 4 5BTSTACK_ROOT = ../.. 6 7CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include 8 9CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 10CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 11 12LDFLAGS += -lCppUTest -lCppUTestExt 13LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 14LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 15 16VPATH += ${BTSTACK_ROOT}/src/ble 17VPATH += ${BTSTACK_ROOT}/src 18VPATH += ${BTSTACK_ROOT}/platform/posix 19 20COMMON = \ 21 btstack_linked_list.c \ 22 btstack_memory.c \ 23 btstack_memory_pool.c \ 24 btstack_run_loop.c \ 25 btstack_run_loop_posix.c \ 26 btstack_util.c \ 27 hci.c \ 28 hci_cmd.c \ 29 hci_dump.c \ 30 31COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 32COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 33 34all: build-coverage/ad_parser_test build-asan/ad_parser_test 35 36build-%: 37 mkdir -p $@ 38 39build-coverage/%.o: %.c | build-coverage 40 ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 41 42build-asan/%.o: %.c | build-asan 43 ${CC} -c $(CFLAGS_ASAN) $< -o $@ 44 45build-coverage/ad_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/ad_parser_test.o | build-coverage 46 ${CC} $^ ${LDFLAGS_COVERAGE} -o $@ 47 48build-asan/ad_parser_test: ${COMMON_OBJ_ASAN} build-asan/ad_parser_test.o | build-asan 49 ${CC} $^ ${LDFLAGS_ASAN} -o $@ 50 51test: all 52 build-asan/ad_parser_test 53 54coverage: all 55 rm -f build-coverage/*.gcda 56 build-coverage/ad_parser_test 57 58clean: 59 rm -rf build-coverage build-asan 60