1bc37f7b0SMilanka Ringwald# Requirements: cpputest.github.io 2bc37f7b0SMilanka Ringwald 3bc37f7b0SMilanka RingwaldBTSTACK_ROOT = ../.. 4bc37f7b0SMilanka Ringwald 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.. 12bc37f7b0SMilanka RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 13bc37f7b0SMilanka Ringwald 14bc37f7b0SMilanka RingwaldVPATH += ${BTSTACK_ROOT}/src 15bc37f7b0SMilanka Ringwald 16bc37f7b0SMilanka RingwaldCOMMON = \ 17bc37f7b0SMilanka Ringwald btstack_ring_buffer.c \ 18bc37f7b0SMilanka Ringwald 19cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 2071d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 21bc37f7b0SMilanka Ringwald 22cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 23cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 24cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 25bc37f7b0SMilanka Ringwald 26cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) 27cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) 28cd56fb44SMatthias Ringwald 29cd56fb44SMatthias Ringwaldall: build-coverage/btstack_ring_buffer_test build-asan/btstack_ring_buffer_test 30cd56fb44SMatthias Ringwald 31cd56fb44SMatthias Ringwaldbuild-%: 32cd56fb44SMatthias Ringwald mkdir -p $@ 333d87570fSMatthias Ringwald 343d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 35cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 363d87570fSMatthias Ringwald 371d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 381d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 391d3bd1e5SMatthias Ringwald 40cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 41cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 42cd56fb44SMatthias Ringwald 431d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 441d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 451d3bd1e5SMatthias Ringwald 46cd56fb44SMatthias Ringwald 47cd56fb44SMatthias Ringwaldbuild-coverage/btstack_ring_buffer_test: ${COMMON_OBJ_COVERAGE} build-coverage/btstack_ring_buffer_test.o | build-coverage 481d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 49cd56fb44SMatthias Ringwald 50cd56fb44SMatthias Ringwaldbuild-asan/btstack_ring_buffer_test: ${COMMON_OBJ_ASAN} build-asan/btstack_ring_buffer_test.o | build-asan 511d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 52cd56fb44SMatthias Ringwald 53bc37f7b0SMilanka Ringwald 54bc37f7b0SMilanka Ringwaldtest: all 55cd56fb44SMatthias Ringwald build-asan/btstack_ring_buffer_test 563d87570fSMatthias Ringwald 573d87570fSMatthias Ringwaldcoverage: all 58cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 593d87570fSMatthias Ringwald build-coverage/btstack_ring_buffer_test 60bc37f7b0SMilanka Ringwald 61bc37f7b0SMilanka Ringwaldclean: 62cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 63bc37f7b0SMilanka Ringwald 64