xref: /btstack/test/security_manager/Makefile (revision 31437b52049f7a1b5a54d9c71f935fe16cc0e09d)
1fdcd1130S[email protected]CC = g++
2fdcd1130S[email protected]
38e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io
4fdcd1130S[email protected]
5fdcd1130S[email protected]BTSTACK_ROOT =  ../..
6fdcd1130S[email protected]
794d1976dSMatthias RingwaldCFLAGS  = -DUNIT_TEST -g
8e2c00bfeSMatthias RingwaldCFLAGS += -Wall -Wno-unused
990fe6d5fSMatthias RingwaldCFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src
1090fe6d5fSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/platform/embedded
11*31437b52SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/platform/posix
1294d1976dSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include
13af03003cSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
14f13fc290SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael
1557fe2af8SMatthias RingwaldLDFLAGS +=  -lCppUTest -lCppUTestExt
1657fe2af8SMatthias Ringwald
1757fe2af8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src
183edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble
1990fe6d5fSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/embedded
20*31437b52SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix
21af03003cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
22f13fc290SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/rijndael
23fdcd1130S[email protected]
24fdcd1130S[email protected]COMMON = \
256894dd39SMatthias Ringwald	btstack_crypto.c    		\
264ab92137SMatthias Ringwald	btstack_linked_list.c		\
2757fe2af8SMatthias Ringwald	btstack_memory.c			\
28d2e6c4b7SMatthias Ringwald	btstack_memory_pool.c		\
294ab92137SMatthias Ringwald	btstack_run_loop.c			\
3090fe6d5fSMatthias Ringwald	btstack_run_loop_embedded.c \
3156042629SMatthias Ringwald	hci_cmd.c					\
3257fe2af8SMatthias Ringwald	hci_dump.c					\
33*31437b52SMatthias Ringwald	hci_dump_posix_fs.c  		\
3457fe2af8SMatthias Ringwald	le_device_db_memory.c       \
35a484130cSMatthias Ringwald	mock.c 				        \
364ab92137SMatthias Ringwald	rijndael.c 					\
374ab92137SMatthias Ringwald	sm.c     					\
38eb886013SMatthias Ringwald	btstack_util.c			            \
39489a58deSMatthias Ringwald	btstack_tlv.c \
40fdcd1130S[email protected]
41cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
4271d52576SMatthias RingwaldCFLAGS_ASAN     = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
43fdcd1130S[email protected]
44cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt
45cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
46cd56fb44SMatthias RingwaldLDFLAGS_ASAN     = ${LDFLAGS} -fsanitize=address
4794d1976dSMatthias Ringwald
48e2c00bfeSMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) build-coverage/uECC.c.o
49e2c00bfeSMatthias RingwaldCOMMON_OBJ_ASAN     = $(addprefix build-asan/,    $(COMMON:.c=.o)) build-asan/uECC.c.o
50cd56fb44SMatthias Ringwald
51cd56fb44SMatthias Ringwaldall: build-coverage/security_manager build-asan/security_manager
52cd56fb44SMatthias Ringwald
53cd56fb44SMatthias Ringwaldbuild-%:
54cd56fb44SMatthias Ringwald	mkdir -p $@
55af03003cSMatthias Ringwald
563d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage
57cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_COVERAGE) $< -o $@
58fdcd1130S[email protected]
59e2c00bfeSMatthias Ringwaldbuild-coverage/%.c.o: %.c | build-coverage
60e2c00bfeSMatthias Ringwald	gcc -c $(CFLAGS_COVERAGE) $< -o $@
61e2c00bfeSMatthias Ringwald
62cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan
63cd56fb44SMatthias Ringwald	${CC} -c $(CFLAGS_ASAN) $< -o $@
64cd56fb44SMatthias Ringwald
65e2c00bfeSMatthias Ringwaldbuild-asan/%.c.o: %.c | build-asan
66e2c00bfeSMatthias Ringwald	gcc -c $(CFLAGS_ASAN) $< -o $@
67cd56fb44SMatthias Ringwald
68e2c00bfeSMatthias Ringwald
69e2c00bfeSMatthias Ringwaldbuild-coverage/security_manager: ${COMMON_OBJ_COVERAGE} build-coverage/security_manager.o | build-coverage
70cd56fb44SMatthias Ringwald	${CC} $^ ${LDFLAGS_COVERAGE} -o $@
71cd56fb44SMatthias Ringwald
72e2c00bfeSMatthias Ringwaldbuild-asan/security_manager: ${COMMON_OBJ_ASAN} build-asan/security_manager.o | build-asan
73cd56fb44SMatthias Ringwald	${CC} $^ ${LDFLAGS_ASAN} -o $@
74cd56fb44SMatthias Ringwald
75fdcd1130S[email protected]
768e8dfe94SMatthias Ringwaldtest: all
77cd56fb44SMatthias Ringwald	build-asan/security_manager
783d87570fSMatthias Ringwald
793d87570fSMatthias Ringwaldcoverage: all
80cd56fb44SMatthias Ringwald	rm -f build-coverage/*.gcda
813d87570fSMatthias Ringwald	build-coverage/security_manager
8257fe2af8SMatthias Ringwald
83fdcd1130S[email protected]clean:
84cd56fb44SMatthias Ringwald	rm -rf build-coverage build-asan
85