119650ae8SMilanka Ringwald# Requirements: cpputest.github.io 219650ae8SMilanka Ringwald 319650ae8SMilanka RingwaldBTSTACK_ROOT = ../.. 419650ae8SMilanka Ringwald 598e87e77SMatthias Ringwald# CppuTest from pkg-config 698e87e77SMatthias RingwaldCFLAGS += ${shell pkg-config --cflags CppuTest} 798e87e77SMatthias RingwaldLDFLAGS += ${shell pkg-config --libs CppuTest} 898e87e77SMatthias Ringwald 998e87e77SMatthias RingwaldCFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null 10e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/src 11*ec4690afSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include 12*ec4690afSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include 13e0ff5d41SMatthias RingwaldCFLAGS += -I.. 1419650ae8SMilanka Ringwald 1519650ae8SMilanka RingwaldVPATH += ${BTSTACK_ROOT}/src 1619650ae8SMilanka RingwaldVPATH += ${BTSTACK_ROOT}/src/classic 1719650ae8SMilanka RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix 1819650ae8SMilanka Ringwald 1919650ae8SMilanka RingwaldCOMMON = \ 2019650ae8SMilanka Ringwald btstack_util.c \ 2119650ae8SMilanka Ringwald btstack_linked_list.c \ 2219650ae8SMilanka Ringwald hci_dump.c \ 2319650ae8SMilanka Ringwald avdtp_util.c \ 2419650ae8SMilanka Ringwald 2519650ae8SMilanka Ringwald 26cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 2771d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 2819650ae8SMilanka Ringwald 29cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 30cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 31cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 323d87570fSMatthias Ringwald 33cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 34cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 35cd56fb44SMatthias Ringwald 36cd56fb44SMatthias Ringwaldall: build-coverage/avdtp_util_test build-asan/avdtp_util_test 37cd56fb44SMatthias Ringwald 38cd56fb44SMatthias Ringwaldbuild-%: 39cd56fb44SMatthias Ringwald mkdir -p $@ 40cd56fb44SMatthias Ringwald 41cd56fb44SMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 42cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 43cd56fb44SMatthias Ringwald 441d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 451d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 461d3bd1e5SMatthias Ringwald 47cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 48cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 49cd56fb44SMatthias Ringwald 501d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 511d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 521d3bd1e5SMatthias Ringwald 53cd56fb44SMatthias Ringwaldbuild-coverage/avdtp_util_test: ${COMMON_OBJ_COVERAGE} build-coverage/avdtp_util_test.o | build-coverage 541d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 55cd56fb44SMatthias Ringwald 56cd56fb44SMatthias Ringwaldbuild-asan/avdtp_util_test: ${COMMON_OBJ_ASAN} build-asan/avdtp_util_test.o | build-asan 571d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 5819650ae8SMilanka Ringwald 5919650ae8SMilanka Ringwaldtest: all 60cd56fb44SMatthias Ringwald build-asan/avdtp_util_test 613d87570fSMatthias Ringwald 623d87570fSMatthias Ringwaldcoverage: all 63cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 643d87570fSMatthias Ringwald build-coverage/avdtp_util_test 6519650ae8SMilanka Ringwald 6619650ae8SMilanka Ringwaldclean: 67cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 6819650ae8SMilanka Ringwald 69