1d1700513SMatthias RingwaldBTSTACK_ROOT = ../.. 2*98e87e77SMatthias Ringwald 3*98e87e77SMatthias Ringwald# CppuTest from pkg-config 4*98e87e77SMatthias RingwaldCFLAGS += ${shell pkg-config --cflags CppuTest} 5*98e87e77SMatthias RingwaldLDFLAGS += ${shell pkg-config --libs CppuTest} 6d1700513SMatthias Ringwald 73d87570fSMatthias RingwaldCOMMON = \ 83d87570fSMatthias Ringwald btstack_tlv_posix.c \ 93d87570fSMatthias Ringwald btstack_util.c \ 103d87570fSMatthias Ringwald btstack_linked_list.c \ 113d87570fSMatthias Ringwald hci_dump.c \ 12bdf6d26aSMatthias Ringwald hci_dump_posix_fs.c \ 133d87570fSMatthias Ringwald 14d1700513SMatthias RingwaldVPATH = \ 15d1700513SMatthias Ringwald ${BTSTACK_ROOT}/src \ 16d1700513SMatthias Ringwald ${BTSTACK_ROOT}/src/classic \ 17d1700513SMatthias Ringwald ${BTSTACK_ROOT}/src/ble \ 18d1700513SMatthias Ringwald ${BTSTACK_ROOT}/platform/posix \ 19d1700513SMatthias Ringwald 20e0ff5d41SMatthias Ringwald 21*98e87e77SMatthias RingwaldCFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null 22e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/src 23e0ff5d41SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/platform/posix 24e0ff5d41SMatthias RingwaldCFLAGS += -I.. 25d1700513SMatthias Ringwald 26d1700513SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 27d1700513SMatthias Ringwald 28cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 2971d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 30d1700513SMatthias Ringwald 31cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 32cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 33cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 34cd56fb44SMatthias Ringwald 35cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 36cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 37cd56fb44SMatthias Ringwald 38cd56fb44SMatthias Ringwaldall: build-coverage/tlv_test build-asan/tlv_test 39cd56fb44SMatthias Ringwald 40cd56fb44SMatthias Ringwaldbuild-%: 41cd56fb44SMatthias Ringwald mkdir -p $@ 42d1700513SMatthias Ringwald 433d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 44cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 45d1700513SMatthias Ringwald 461d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 471d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 481d3bd1e5SMatthias Ringwald 49cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 50cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 51cd56fb44SMatthias Ringwald 521d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 531d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 541d3bd1e5SMatthias Ringwald 55cd56fb44SMatthias Ringwald 56cd56fb44SMatthias Ringwaldbuild-coverage/tlv_test: ${COMMON_OBJ_COVERAGE} build-coverage/tlv_test.o | build-coverage 571d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 58cd56fb44SMatthias Ringwald 59cd56fb44SMatthias Ringwaldbuild-asan/tlv_test: ${COMMON_OBJ_ASAN} build-asan/tlv_test.o | build-asan 601d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 61cd56fb44SMatthias Ringwald 62d1700513SMatthias Ringwald 63d1700513SMatthias Ringwaldtest: all 64cd56fb44SMatthias Ringwald build-asan/tlv_test 65d1700513SMatthias Ringwald 663d87570fSMatthias Ringwaldcoverage: all 67cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 683d87570fSMatthias Ringwald build-coverage/tlv_test 693d87570fSMatthias Ringwald 703d87570fSMatthias Ringwaldclean: 71cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 72