18e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io 27ebf954cS[email protected] 37ebf954cS[email protected]BTSTACK_ROOT = ../.. 47ebf954cS[email protected] 5*1d3bd1e5SMatthias RingwaldCFLAGS = -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null 6e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/src 7e0ff5d41SMatthias RingwaldCFLAGS += -I.. 8e0ff5d41SMatthias Ringwald 9cd56fb44SMatthias Ringwald 10cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 1171d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 12cd56fb44SMatthias Ringwald 1357fe2af8SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 14cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 15cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 1657fe2af8SMatthias Ringwald 1757fe2af8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src 183edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/classic 19dd9e275cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix 207ebf954cS[email protected] 217ebf954cS[email protected]COMMON = \ 2257fe2af8SMatthias Ringwald sdp_util.c \ 23e04f4e1fSMatthias Ringwald hci_dump.c \ 24eb886013SMatthias Ringwald btstack_util.c 257ebf954cS[email protected] 26cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 27cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 287ebf954cS[email protected] 29cd56fb44SMatthias Ringwaldall: build-coverage/des_iterator_test build-asan/des_iterator_test 307ebf954cS[email protected] 31cd56fb44SMatthias Ringwaldbuild-%: 32cd56fb44SMatthias Ringwald mkdir -p $@ 333d87570fSMatthias Ringwald 34cd56fb44SMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 35cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 36cd56fb44SMatthias Ringwald 37*1d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 38*1d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 39*1d3bd1e5SMatthias Ringwald 40cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 41cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 42cd56fb44SMatthias Ringwald 43*1d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 44*1d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 45*1d3bd1e5SMatthias Ringwald 46cd56fb44SMatthias Ringwald 47cd56fb44SMatthias Ringwaldbuild-coverage/des_iterator_test: ${COMMON_OBJ_COVERAGE} build-coverage/des_iterator_test.o | build-coverage 48*1d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 49cd56fb44SMatthias Ringwald 50cd56fb44SMatthias Ringwaldbuild-asan/des_iterator_test: ${COMMON_OBJ_ASAN} build-asan/des_iterator_test.o | build-asan 51*1d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 52cd56fb44SMatthias Ringwald 537ebf954cS[email protected] 548e8dfe94SMatthias Ringwaldtest: all 55cd56fb44SMatthias Ringwald build-asan/des_iterator_test 563d87570fSMatthias Ringwald 573d87570fSMatthias Ringwaldcoverage: all 58cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 593d87570fSMatthias Ringwald build-coverage/des_iterator_test 607ebf954cS[email protected] 617ebf954cS[email protected]clean: 62cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 637ebf954cS[email protected] 64