18e8dfe94SMatthias Ringwald# Requirements: cpputest.github.io 2fdcd1130S[email protected] 3fdcd1130S[email protected]BTSTACK_ROOT = ../.. 4fdcd1130S[email protected] 5e0ff5d41SMatthias RingwaldCFLAGS = -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null 690fe6d5fSMatthias RingwaldCFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src 790fe6d5fSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/platform/embedded 831437b52SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/platform/posix 994d1976dSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include 10af03003cSMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc 11f13fc290SMatthias RingwaldCFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael 1257fe2af8SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 1357fe2af8SMatthias Ringwald 1457fe2af8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src 153edc84c5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble 1690fe6d5fSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/embedded 1731437b52SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/posix 18af03003cSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc 19f13fc290SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/rijndael 20fdcd1130S[email protected] 21fdcd1130S[email protected]COMMON = \ 226894dd39SMatthias Ringwald btstack_crypto.c \ 234ab92137SMatthias Ringwald btstack_linked_list.c \ 2457fe2af8SMatthias Ringwald btstack_memory.c \ 25d2e6c4b7SMatthias Ringwald btstack_memory_pool.c \ 264ab92137SMatthias Ringwald btstack_run_loop.c \ 2790fe6d5fSMatthias Ringwald btstack_run_loop_embedded.c \ 2856042629SMatthias Ringwald hci_cmd.c \ 2957fe2af8SMatthias Ringwald hci_dump.c \ 3031437b52SMatthias Ringwald hci_dump_posix_fs.c \ 3157fe2af8SMatthias Ringwald le_device_db_memory.c \ 32a484130cSMatthias Ringwald mock.c \ 334ab92137SMatthias Ringwald rijndael.c \ 344ab92137SMatthias Ringwald sm.c \ 35eb886013SMatthias Ringwald btstack_util.c \ 36489a58deSMatthias Ringwald btstack_tlv.c \ 37fdcd1130S[email protected] 38cd56fb44SMatthias RingwaldCFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage 3971d52576SMatthias RingwaldCFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT 40fdcd1130S[email protected] 41cd56fb44SMatthias RingwaldLDFLAGS += -lCppUTest -lCppUTestExt 42cd56fb44SMatthias RingwaldLDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage 43cd56fb44SMatthias RingwaldLDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address 4494d1976dSMatthias Ringwald 45e0ff5d41SMatthias RingwaldCOMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) build-coverage/uECC.o 46e0ff5d41SMatthias RingwaldCOMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) build-asan/uECC.o 47cd56fb44SMatthias Ringwald 48cd56fb44SMatthias Ringwaldall: build-coverage/security_manager build-asan/security_manager 49cd56fb44SMatthias Ringwald 50cd56fb44SMatthias Ringwaldbuild-%: 51cd56fb44SMatthias Ringwald mkdir -p $@ 52af03003cSMatthias Ringwald 533d87570fSMatthias Ringwaldbuild-coverage/%.o: %.c | build-coverage 54e0ff5d41SMatthias Ringwald ${CC} -c $(CFLAGS_COVERAGE) $< -o $@ 55cd56fb44SMatthias Ringwald 56*1d3bd1e5SMatthias Ringwaldbuild-coverage/%.o: %.cpp | build-coverage 57*1d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_COVERAGE) $< -o $@ 58*1d3bd1e5SMatthias Ringwald 59e0ff5d41SMatthias Ringwaldbuild-asan/%.o: %.c | build-asan 60*1d3bd1e5SMatthias Ringwald ${CC} -c $(CFLAGS_ASAN) $< -o $@ 61cd56fb44SMatthias Ringwald 62e0ff5d41SMatthias Ringwaldbuild-asan/%.o: %.cpp | build-asan 63*1d3bd1e5SMatthias Ringwald ${CXX} -c $(CFLAGS_ASAN) $< -o $@ 64e0ff5d41SMatthias Ringwald 65e2c00bfeSMatthias Ringwald 66e2c00bfeSMatthias Ringwaldbuild-coverage/security_manager: ${COMMON_OBJ_COVERAGE} build-coverage/security_manager.o | build-coverage 67*1d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_COVERAGE} -o $@ 68cd56fb44SMatthias Ringwald 69e2c00bfeSMatthias Ringwaldbuild-asan/security_manager: ${COMMON_OBJ_ASAN} build-asan/security_manager.o | build-asan 70*1d3bd1e5SMatthias Ringwald ${CXX} $^ ${LDFLAGS_ASAN} -o $@ 71cd56fb44SMatthias Ringwald 72fdcd1130S[email protected] 738e8dfe94SMatthias Ringwaldtest: all 74cd56fb44SMatthias Ringwald build-asan/security_manager 753d87570fSMatthias Ringwald 763d87570fSMatthias Ringwaldcoverage: all 77cd56fb44SMatthias Ringwald rm -f build-coverage/*.gcda 783d87570fSMatthias Ringwald build-coverage/security_manager 7957fe2af8SMatthias Ringwald 80fdcd1130S[email protected]clean: 81cd56fb44SMatthias Ringwald rm -rf build-coverage build-asan 82