112ccb71bSMatthias RingwaldCC = g++ 212ccb71bSMatthias Ringwald 312ccb71bSMatthias Ringwald# Requirements: cpputest.github.io 412ccb71bSMatthias Ringwald 512ccb71bSMatthias RingwaldBTSTACK_ROOT = ../.. 612ccb71bSMatthias Ringwald 712ccb71bSMatthias RingwaldCPPFLAGS = -x c++ -Wall -Wno-unused 8b338ca60SMatthias Ringwald 9b338ca60SMatthias RingwaldCFLAGS = -DUNIT_TEST -g 10*31437b52SMatthias RingwaldCFLAGS += -I. -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/platform/posix 11*31437b52SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src ${BTSTACK_ROOT}/platform/posix 1212ccb71bSMatthias Ringwald 1312ccb71bSMatthias RingwaldCOMMON = \ 143d87570fSMatthias Ringwald btstack_util.c \ 153d87570fSMatthias Ringwald btstack_hid_parser.c \ 16*31437b52SMatthias Ringwald hci_dump.c \ 17*31437b52SMatthias Ringwald hci_dump_posix_fs.c \ 1812ccb71bSMatthias Ringwald 19cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 2071d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 2112ccb71bSMatthias Ringwald 22cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 23cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 24cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 2512ccb71bSMatthias 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/hid_parser_test build-asan/hid_parser_test 30cd56fb44SMatthias Ringwald 31cd56fb44SMatthias Ringwaldbuild-%: 32cd56fb44SMatthias Ringwald mkdir -p $@ 3312ccb71bSMatthias Ringwald 343d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 35cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 363d87570fSMatthias Ringwald 37cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 38cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 39cd56fb44SMatthias Ringwald 40cd56fb44SMatthias Ringwald 41cd56fb44SMatthias Ringwaldbuild-coverage/hid_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/hid_parser_test.o | build-coverage 42cd56fb44SMatthias Ringwald ${CC} $^ ${LDFLAGS_COVERAGE} -o $@ 43cd56fb44SMatthias Ringwald 44cd56fb44SMatthias Ringwaldbuild-asan/hid_parser_test: ${COMMON_OBJ_ASAN} build-asan/hid_parser_test.o | build-asan 45cd56fb44SMatthias Ringwald ${CC} $^ ${LDFLAGS_ASAN} -o $@ 46cd56fb44SMatthias Ringwald 4712ccb71bSMatthias Ringwald 4812ccb71bSMatthias Ringwaldtest: all 49cd56fb44SMatthias Ringwald build-asan/hid_parser_test 503d87570fSMatthias Ringwald 513d87570fSMatthias Ringwaldcoverage: all 52cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 533d87570fSMatthias Ringwald build-coverage/hid_parser_test 5412ccb71bSMatthias Ringwald 5512ccb71bSMatthias Ringwaldclean: 56cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 5712ccb71bSMatthias Ringwald 58