xref: /btstack/test/hid_parser/Makefile (revision 1d3bd1e51ca491d6783233c8d7431c44f06daa5a)
112ccb71bSMatthias Ringwald# Requirements: cpputest.github.io
212ccb71bSMatthias Ringwald
312ccb71bSMatthias RingwaldBTSTACK_ROOT =  ../..
412ccb71bSMatthias Ringwald
5e0ff5d41SMatthias RingwaldCFLAGS  = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null
6b338ca60SMatthias Ringwald
7e0ff5d41SMatthias RingwaldCFLAGS += -I.
8e0ff5d41SMatthias RingwaldCFLAGS += -I ${BTSTACK_ROOT}/src
9e0ff5d41SMatthias RingwaldCFLAGS += -I ${BTSTACK_ROOT}/platform/posix
10e0ff5d41SMatthias Ringwald
1131437b52SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src ${BTSTACK_ROOT}/platform/posix
1212ccb71bSMatthias Ringwald
1312ccb71bSMatthias RingwaldCOMMON = \
143d87570fSMatthias Ringwald	btstack_util.c \
153d87570fSMatthias Ringwald	btstack_hid_parser.c \
1631437b52SMatthias Ringwald	hci_dump.c \
1731437b52SMatthias 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
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 $@
45cd56fb44SMatthias Ringwald
46cd56fb44SMatthias Ringwaldbuild-coverage/hid_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/hid_parser_test.o | build-coverage
47*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
48cd56fb44SMatthias Ringwald
49cd56fb44SMatthias Ringwaldbuild-asan/hid_parser_test: ${COMMON_OBJ_ASAN} build-asan/hid_parser_test.o | build-asan
50*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_ASAN} -o $@
51cd56fb44SMatthias Ringwald
5212ccb71bSMatthias Ringwald
5312ccb71bSMatthias Ringwaldtest: all
54cd56fb44SMatthias Ringwald	build-asan/hid_parser_test
553d87570fSMatthias Ringwald
563d87570fSMatthias Ringwaldcoverage: all
57cd56fb44SMatthias Ringwald	rm -f build-coverage/*.gcda
583d87570fSMatthias Ringwald	build-coverage/hid_parser_test
5912ccb71bSMatthias Ringwald
6012ccb71bSMatthias Ringwaldclean:
61cd56fb44SMatthias Ringwald	rm -rf build-coverage build-asan
6212ccb71bSMatthias Ringwald
63