CC = g++ # Requirements: cpputest.github.io BTSTACK_ROOT = ../.. CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/include CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT LDFLAGS += -lCppUTest -lCppUTestExt LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address VPATH += ${BTSTACK_ROOT}/src/ble VPATH += ${BTSTACK_ROOT}/src VPATH += ${BTSTACK_ROOT}/platform/posix COMMON = \ btstack_linked_list.c \ btstack_memory.c \ btstack_memory_pool.c \ btstack_run_loop.c \ btstack_run_loop_posix.c \ btstack_util.c \ hci.c \ hci_cmd.c \ hci_dump.c \ COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) all: build-coverage/ad_parser_test build-asan/ad_parser_test build-%: mkdir -p $@ build-coverage/%.o: %.c | build-coverage ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ build-asan/%.o: %.c | build-asan ${CC} -c $(CFLAGS_ASAN) $< -o $@ build-coverage/ad_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/ad_parser_test.o | build-coverage ${CC} $^ ${LDFLAGS_COVERAGE} -o $@ build-asan/ad_parser_test: ${COMMON_OBJ_ASAN} build-asan/ad_parser_test.o | build-asan ${CC} $^ ${LDFLAGS_ASAN} -o $@ test: all build-asan/ad_parser_test coverage: all rm -f build-coverage/*.gcda build-coverage/ad_parser_test clean: rm -rf build-coverage build-asan