btstack/test/ad_parser/Makefile
2022-03-11 22:15:38 +01:00

59 lines
1.5 KiB
Makefile

BTSTACK_ROOT = ../..
CFLAGS = -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null
CFLAGS += -I${BTSTACK_ROOT}/src
CFLAGS += -I..
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
VPATH += ${BTSTACK_ROOT}/src/classic
VPATH += ${BTSTACK_ROOT}/platform/posix
COMMON = \
btstack_util.c \
hci_dump.c \
ad_parser.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/%.o: %.cpp | build-coverage
${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
build-asan/%.o: %.cpp | build-asan
${CXX} -c $(CFLAGS_ASAN) $< -o $@
build-coverage/ad_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/ad_parser_test.o | build-coverage
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
build-asan/ad_parser_test: ${COMMON_OBJ_ASAN} build-asan/ad_parser_test.o | build-asan
${CXX} $^ ${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