1d2011e9eSMilanka RingwaldBTSTACK_ROOT = ../.. 2d2011e9eSMilanka Ringwald 3*98e87e77SMatthias Ringwald# CppuTest from pkg-config 4*98e87e77SMatthias RingwaldCFLAGS += ${shell pkg-config --cflags CppuTest} 5*98e87e77SMatthias RingwaldLDFLAGS += ${shell pkg-config --libs CppuTest} 6*98e87e77SMatthias Ringwald 7*98e87e77SMatthias RingwaldCFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null 8e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/src 9e0ff5d41SMatthias RingwaldCFLAGS += -I.. 10e0ff5d41SMatthias Ringwald 11cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 1271d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 13cd56fb44SMatthias Ringwald 14d2011e9eSMilanka RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 15cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 16cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 17d2011e9eSMilanka Ringwald 18d2011e9eSMilanka RingwaldVPATH += ${BTSTACK_ROOT}/src 19d2011e9eSMilanka RingwaldVPATH += ${BTSTACK_ROOT}/src/classic 20d2011e9eSMilanka RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix 21d2011e9eSMilanka Ringwald 22d2011e9eSMilanka RingwaldCOMMON = \ 23d2011e9eSMilanka Ringwald btstack_util.c \ 24d2011e9eSMilanka Ringwald hci_dump.c \ 25d2011e9eSMilanka Ringwald ad_parser.c \ 26d2011e9eSMilanka Ringwald 27cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 28cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 29d2011e9eSMilanka Ringwald 30cd56fb44SMatthias Ringwaldall: build-coverage/ad_parser_test build-asan/ad_parser_test 31d2011e9eSMilanka Ringwald 32cd56fb44SMatthias Ringwaldbuild-%: 33cd56fb44SMatthias Ringwald mkdir -p $@ 343d87570fSMatthias Ringwald 35cd56fb44SMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 36cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 37cd56fb44SMatthias Ringwald 38cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 39cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 40cd56fb44SMatthias Ringwald 411d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 421d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 431d3bd1e5SMatthias Ringwald 441d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 451d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 461d3bd1e5SMatthias Ringwald 47cd56fb44SMatthias Ringwaldbuild-coverage/ad_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/ad_parser_test.o | build-coverage 481d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 49cd56fb44SMatthias Ringwald 50cd56fb44SMatthias Ringwaldbuild-asan/ad_parser_test: ${COMMON_OBJ_ASAN} build-asan/ad_parser_test.o | build-asan 511d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 52d2011e9eSMilanka Ringwald 53d2011e9eSMilanka Ringwaldtest: all 54cd56fb44SMatthias Ringwald build-asan/ad_parser_test 553d87570fSMatthias Ringwald 563d87570fSMatthias Ringwaldcoverage: all 57cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 583d87570fSMatthias Ringwald build-coverage/ad_parser_test 59d2011e9eSMilanka Ringwald 60d2011e9eSMilanka Ringwaldclean: 61cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 62d2011e9eSMilanka Ringwald 63