18e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io 27ebf954cS[email protected] 37ebf954cS[email protected]BTSTACK_ROOT = ../.. 47ebf954cS[email protected] 5*98e87e77SMatthias Ringwald# CppuTest from pkg-config 6*98e87e77SMatthias RingwaldCFLAGS += ${shell pkg-config --cflags CppuTest} 7*98e87e77SMatthias RingwaldLDFLAGS += ${shell pkg-config --libs CppuTest} 8*98e87e77SMatthias Ringwald 9*98e87e77SMatthias RingwaldCFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null 10e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/src 11e0ff5d41SMatthias RingwaldCFLAGS += -I.. 12e0ff5d41SMatthias Ringwald 13cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 1471d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 15cd56fb44SMatthias Ringwald 1657fe2af8SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 17cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 18cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 1957fe2af8SMatthias Ringwald 2057fe2af8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src 213edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/classic 22dd9e275cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix 237ebf954cS[email protected] 247ebf954cS[email protected]COMMON = \ 2557fe2af8SMatthias Ringwald sdp_util.c \ 26e04f4e1fSMatthias Ringwald hci_dump.c \ 27eb886013SMatthias Ringwald btstack_util.c 287ebf954cS[email protected] 29cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 30cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 317ebf954cS[email protected] 32cd56fb44SMatthias Ringwaldall: build-coverage/des_iterator_test build-asan/des_iterator_test 337ebf954cS[email protected] 34cd56fb44SMatthias Ringwaldbuild-%: 35cd56fb44SMatthias Ringwald mkdir -p $@ 363d87570fSMatthias Ringwald 37cd56fb44SMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 38cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 39cd56fb44SMatthias Ringwald 401d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 411d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 421d3bd1e5SMatthias Ringwald 43cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 44cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 45cd56fb44SMatthias Ringwald 461d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 471d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 481d3bd1e5SMatthias Ringwald 49cd56fb44SMatthias Ringwald 50cd56fb44SMatthias Ringwaldbuild-coverage/des_iterator_test: ${COMMON_OBJ_COVERAGE} build-coverage/des_iterator_test.o | build-coverage 511d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 52cd56fb44SMatthias Ringwald 53cd56fb44SMatthias Ringwaldbuild-asan/des_iterator_test: ${COMMON_OBJ_ASAN} build-asan/des_iterator_test.o | build-asan 541d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 55cd56fb44SMatthias Ringwald 567ebf954cS[email protected] 578e8dfe94SMatthias Ringwaldtest: all 58cd56fb44SMatthias Ringwald build-asan/des_iterator_test 593d87570fSMatthias Ringwald 603d87570fSMatthias Ringwaldcoverage: all 61cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 623d87570fSMatthias Ringwald build-coverage/des_iterator_test 637ebf954cS[email protected] 647ebf954cS[email protected]clean: 65cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 667ebf954cS[email protected] 67