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 8*e2c00bfeSMatthias RingwaldCFLAGS += -Wall -Wno-unused 990fe6d5fSMatthias RingwaldCFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src 1090fe6d5fSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/platform/embedded 1194d1976dSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include 12af03003cSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc 13f13fc290SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael 1457fe2af8SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 1557fe2af8SMatthias Ringwald 1657fe2af8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src 173edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble 1890fe6d5fSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/embedded 1990fe6d5fSMatthias Ringwald# VPATH += ${BTSTACK_ROOT}/platform/posix 20af03003cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc 21f13fc290SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/rijndael 22fdcd1130S[email protected] 23fdcd1130S[email protected]COMMON = \ 246894dd39SMatthias Ringwald btstack_crypto.c \ 254ab92137SMatthias Ringwald btstack_linked_list.c \ 2657fe2af8SMatthias Ringwald btstack_memory.c \ 27d2e6c4b7SMatthias Ringwald btstack_memory_pool.c \ 284ab92137SMatthias Ringwald btstack_run_loop.c \ 2990fe6d5fSMatthias Ringwald btstack_run_loop_embedded.c \ 3056042629SMatthias Ringwald hci_cmd.c \ 3157fe2af8SMatthias Ringwald hci_dump.c \ 3257fe2af8SMatthias Ringwald le_device_db_memory.c \ 33a484130cSMatthias Ringwald mock.c \ 344ab92137SMatthias Ringwald rijndael.c \ 354ab92137SMatthias Ringwald sm.c \ 36eb886013SMatthias Ringwald btstack_util.c \ 37489a58deSMatthias Ringwald btstack_tlv.c \ 38fdcd1130S[email protected] 39cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 40cd56fb44SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address 41fdcd1130S[email protected] 42cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 43cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 44cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 4594d1976dSMatthias Ringwald 46*e2c00bfeSMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) build-coverage/uECC.c.o 47*e2c00bfeSMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) build-asan/uECC.c.o 48cd56fb44SMatthias Ringwald 49cd56fb44SMatthias Ringwaldall: build-coverage/security_manager build-asan/security_manager 50cd56fb44SMatthias Ringwald 51cd56fb44SMatthias Ringwaldbuild-%: 52cd56fb44SMatthias Ringwald mkdir -p $@ 53af03003cSMatthias Ringwald 543d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 55cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 56fdcd1130S[email protected] 57*e2c00bfeSMatthias Ringwaldbuild-coverage/%.c.o: %.c | build-coverage 58*e2c00bfeSMatthias Ringwald gcc -c $(CFLAGS_COVERAGE) $< -o $@ 59*e2c00bfeSMatthias Ringwald 60cd56fb44SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 61cd56fb44SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 62cd56fb44SMatthias Ringwald 63*e2c00bfeSMatthias Ringwaldbuild-asan/%.c.o: %.c | build-asan 64*e2c00bfeSMatthias Ringwald gcc -c $(CFLAGS_ASAN) $< -o $@ 65cd56fb44SMatthias Ringwald 66*e2c00bfeSMatthias Ringwald 67*e2c00bfeSMatthias Ringwaldbuild-coverage/security_manager: ${COMMON_OBJ_COVERAGE} build-coverage/security_manager.o | build-coverage 68cd56fb44SMatthias Ringwald ${CC} $^ ${LDFLAGS_COVERAGE} -o $@ 69cd56fb44SMatthias Ringwald 70*e2c00bfeSMatthias Ringwaldbuild-asan/security_manager: ${COMMON_OBJ_ASAN} build-asan/security_manager.o | build-asan 71cd56fb44SMatthias Ringwald ${CC} $^ ${LDFLAGS_ASAN} -o $@ 72cd56fb44SMatthias Ringwald 73fdcd1130S[email protected] 748e8dfe94SMatthias Ringwaldtest: all 75cd56fb44SMatthias Ringwald build-asan/security_manager 763d87570fSMatthias Ringwald 773d87570fSMatthias Ringwaldcoverage: all 78cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 793d87570fSMatthias Ringwald build-coverage/security_manager 8057fe2af8SMatthias Ringwald 81fdcd1130S[email protected]clean: 82cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 83