xref: /btstack/test/ble_client/Makefile (revision 1d3bd1e51ca491d6783233c8d7431c44f06daa5a)
18e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io
260c84a44S[email protected]
360c84a44S[email protected]BTSTACK_ROOT =  ../..
460c84a44S[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
13a35c9b93SMilanka RingwaldLDFLAGS += -lCppUTest -lCppUTestExt
14cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
15cd56fb44SMatthias RingwaldLDFLAGS_ASAN     = ${LDFLAGS} -fsanitize=address
1660c84a44S[email protected]
173edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble
18cbe987fbSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src
19dd9e275cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix
20cbe987fbSMatthias Ringwald
2160c84a44S[email protected]COMMON = \
224fd23d47SMatthias Ringwald	btstack_linked_list.c	    \
23cbe987fbSMatthias Ringwald	btstack_memory.c			\
24f032a441SMatthias Ringwald	btstack_memory_pool.c		\
25f032a441SMatthias Ringwald	btstack_run_loop.c			\
26f032a441SMatthias Ringwald	btstack_run_loop_posix.c 	\
27f032a441SMatthias Ringwald	btstack_util.c			    \
28a484130cSMatthias Ringwald	hci.c                       \
2956042629SMatthias Ringwald	hci_cmd.c					\
30cbe987fbSMatthias Ringwald	hci_dump.c					\
3160c84a44S[email protected]
32cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
33cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN     = $(addprefix build-asan/,    $(COMMON:.c=.o))
3460c84a44S[email protected]
35cd56fb44SMatthias Ringwaldall: build-coverage/ad_parser_test build-asan/ad_parser_test
3660c84a44S[email protected]
37cd56fb44SMatthias Ringwaldbuild-%:
38cd56fb44SMatthias Ringwald	mkdir -p $@
393d87570fSMatthias Ringwald
40cd56fb44SMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage
41cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_COVERAGE) $< -o $@
42cd56fb44SMatthias Ringwald
43*1d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage
44*1d3bd1e5SMatthias Ringwald	${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
45*1d3bd1e5SMatthias Ringwald
46cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan
47cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_ASAN) $< -o $@
48cd56fb44SMatthias Ringwald
49*1d3bd1e5SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan
50*1d3bd1e5SMatthias Ringwald	${CXX} -c $(CFLAGS_ASAN) $< -o $@
51*1d3bd1e5SMatthias Ringwald
52cd56fb44SMatthias Ringwaldbuild-coverage/ad_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/ad_parser_test.o | build-coverage
53*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
54cd56fb44SMatthias Ringwald
55cd56fb44SMatthias Ringwaldbuild-asan/ad_parser_test: ${COMMON_OBJ_ASAN} build-asan/ad_parser_test.o | build-asan
56*1d3bd1e5SMatthias Ringwald	${CXX} $^ ${LDFLAGS_ASAN} -o $@
5760c84a44S[email protected]
588e8dfe94SMatthias Ringwaldtest: all
59cd56fb44SMatthias Ringwald	build-asan/ad_parser_test
603d87570fSMatthias Ringwald
613d87570fSMatthias Ringwaldcoverage: all
62cd56fb44SMatthias Ringwald	rm -f build-coverage/*.gcda
633d87570fSMatthias Ringwald	build-coverage/ad_parser_test
6457fe2af8SMatthias Ringwald
6560c84a44S[email protected]clean:
66cd56fb44SMatthias Ringwald	rm -rf build-coverage build-asan
67