xref: /btstack/test/gatt_client/Makefile (revision 6bdecec7ba8f55d805af8d13b9f45c3a7f6d5810)
1f45e14b1S[email protected]CC = g++
2f45e14b1S[email protected]
38e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io
4f45e14b1S[email protected]
5f45e14b1S[email protected]BTSTACK_ROOT =  ../..
6f45e14b1S[email protected]
73d87570fSMatthias RingwaldCFLAGS  = -DUNIT_TEST -x c++ -g -Wall -Wnarrowing -Wconversion-null -I. -Ibuild-coverage -I${BTSTACK_ROOT}/src
8f45e14b1S[email protected]
9cbe987fbSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src
103edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble
11*6bdecec7SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble/gatt-service
12dd9e275cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix
13cbe987fbSMatthias Ringwald
14f45e14b1S[email protected]COMMON = \
15a484130cSMatthias Ringwald	ad_parser.c                 \
167b4ad037SMatthias Ringwald	ancs_client.c               \
17591423b2SMatthias Ringwald	att_db.c                    \
18a484130cSMatthias Ringwald	att_dispatch.c              \
194fd23d47SMatthias Ringwald	btstack_linked_list.c       \
20cbe987fbSMatthias Ringwald	btstack_memory.c            \
21489a58deSMatthias Ringwald	btstack_memory_pool.c       \
22489a58deSMatthias Ringwald	btstack_util.c              \
23a484130cSMatthias Ringwald	gatt_client.c               \
2456042629SMatthias Ringwald	hci_cmd.c                   \
25cbe987fbSMatthias Ringwald	hci_dump.c                  \
2657fe2af8SMatthias Ringwald	le_device_db_memory.c       \
279796ebeaSMatthias Ringwald	mock.c                      \
287bdc6798S[email protected]
29cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
3071d52576SMatthias RingwaldCFLAGS_ASAN     = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
31f45e14b1S[email protected]
32cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt
33cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
34cd56fb44SMatthias RingwaldLDFLAGS_ASAN     = ${LDFLAGS} -fsanitize=address
353d87570fSMatthias Ringwald
36cd56fb44SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
37cd56fb44SMatthias RingwaldCOMMON_OBJ_ASAN     = $(addprefix build-asan/,    $(COMMON:.c=.o))
38cd56fb44SMatthias Ringwald
39cd56fb44SMatthias Ringwaldall: build-coverage/gatt_client_test build-coverage/le_central build-asan/gatt_client_test build-asan/le_central
40cd56fb44SMatthias Ringwald
41cd56fb44SMatthias Ringwaldbuild-%:
42cd56fb44SMatthias Ringwald	mkdir -p $@
43f45e14b1S[email protected]
444d890b2dS[email protected]# compile .ble description
45cd56fb44SMatthias Ringwaldbuild-%/profile.h: profile.gatt | build-%
4675c13281SMatthias Ringwald	python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
474d890b2dS[email protected]
483d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage
49cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_COVERAGE) $< -o $@
50f45e14b1S[email protected]
51cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan
52cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_ASAN) $< -o $@
533d87570fSMatthias Ringwald
54cd56fb44SMatthias Ringwaldbuild-coverage/gatt_client_test: ${COMMON_OBJ_COVERAGE} build-coverage/profile.h build-coverage/gatt_client_test.o expected_results.h | build-coverage
55cd56fb44SMatthias Ringwald	${CC} $(filter-out build-coverage/profile.h expected_results.h,$^) ${LDFLAGS_COVERAGE} -o $@
56cd56fb44SMatthias Ringwald
57cd56fb44SMatthias Ringwaldbuild-coverage/le_central: ${COMMON_OBJ_COVERAGE} build-coverage/le_central.o | build-coverage
58cd56fb44SMatthias Ringwald	${CC} $^ ${LDFLAGS_COVERAGE} -o $@
59cd56fb44SMatthias Ringwald
60cd56fb44SMatthias Ringwaldbuild-asan/gatt_client_test: ${COMMON_OBJ_ASAN} build-asan/profile.h  build-asan/gatt_client_test.o expected_results.h | build-asan
61cd56fb44SMatthias Ringwald	${CC} $(filter-out build-asan/profile.h expected_results.h,$^) ${LDFLAGS_ASAN} -o $@
62cd56fb44SMatthias Ringwald
63cd56fb44SMatthias Ringwaldbuild-asan/le_central: ${COMMON_OBJ_ASAN} build-asan/le_central.o | build-asan
64cd56fb44SMatthias Ringwald	${CC} $^ ${LDFLAGS_ASAN} -o $@
65ee988ca9S[email protected]
668e8dfe94SMatthias Ringwaldtest: all
67cd56fb44SMatthias Ringwald	build-asan/gatt_client_test
68cd56fb44SMatthias Ringwald	build-asan/le_central
693d87570fSMatthias Ringwald
703d87570fSMatthias Ringwaldcoverage: all
71cd56fb44SMatthias Ringwald	rm -f build-coverage/*.gcda
723d87570fSMatthias Ringwald	build-coverage/gatt_client_test
733d87570fSMatthias Ringwald	build-coverage/le_central
7457fe2af8SMatthias Ringwald
75f45e14b1S[email protected]clean:
76cd56fb44SMatthias Ringwald	rm -rf build-coverage build-asan
77f45e14b1S[email protected]
78