2014-04-11 15:14:38 +00:00
|
|
|
CC = g++
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
# Requirements: cpputest.github.io
|
2014-04-11 15:14:38 +00:00
|
|
|
|
|
|
|
BTSTACK_ROOT = ../..
|
|
|
|
|
2021-06-12 12:03:02 +02:00
|
|
|
CFLAGS = -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null
|
2020-09-16 10:24:43 +02:00
|
|
|
CFLAGS += -I. -I.. -I${BTSTACK_ROOT}/src
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/platform/embedded
|
2021-03-10 14:50:44 +01:00
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/platform/posix
|
2016-05-04 16:08:44 +02:00
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/mbedtls/include
|
2017-04-13 13:57:37 +02:00
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
|
2019-12-07 21:42:31 +01:00
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/3rd-party/rijndael
|
2015-05-17 18:07:24 +02:00
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
|
|
|
|
|
|
|
VPATH += ${BTSTACK_ROOT}/src
|
2015-11-13 15:04:41 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/ble
|
2020-09-16 10:24:43 +02:00
|
|
|
VPATH += ${BTSTACK_ROOT}/platform/embedded
|
2021-03-10 14:50:44 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
2017-04-13 13:57:37 +02:00
|
|
|
VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
|
2019-12-07 21:42:31 +01:00
|
|
|
VPATH += ${BTSTACK_ROOT}/3rd-party/rijndael
|
2014-04-11 15:14:38 +00:00
|
|
|
|
|
|
|
COMMON = \
|
2019-09-17 15:11:58 +02:00
|
|
|
btstack_crypto.c \
|
|
|
|
btstack_linked_list.c \
|
|
|
|
btstack_memory.c \
|
|
|
|
btstack_memory_pool.c \
|
|
|
|
btstack_run_loop.c \
|
2020-09-16 10:24:43 +02:00
|
|
|
btstack_run_loop_embedded.c \
|
2019-09-17 15:11:58 +02:00
|
|
|
hci_cmd.c \
|
|
|
|
hci_dump.c \
|
2021-03-10 14:50:44 +01:00
|
|
|
hci_dump_posix_fs.c \
|
2019-09-17 15:11:58 +02:00
|
|
|
le_device_db_memory.c \
|
|
|
|
mock.c \
|
|
|
|
rijndael.c \
|
|
|
|
sm.c \
|
|
|
|
btstack_util.c \
|
2019-03-30 21:30:47 +01:00
|
|
|
btstack_tlv.c \
|
2019-09-17 15:11:58 +02:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
|
2021-01-29 21:47:15 +01:00
|
|
|
CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
|
2014-04-11 15:14:38 +00:00
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
|
|
|
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
|
|
|
|
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
|
2016-05-04 16:08:44 +02:00
|
|
|
|
2021-06-12 12:03:02 +02:00
|
|
|
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o)) build-coverage/uECC.o
|
|
|
|
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o)) build-asan/uECC.o
|
2020-12-01 22:13:09 +01:00
|
|
|
|
|
|
|
all: build-coverage/security_manager build-asan/security_manager
|
|
|
|
|
|
|
|
build-%:
|
|
|
|
mkdir -p $@
|
2017-04-13 13:57:37 +02:00
|
|
|
|
2020-11-30 21:35:42 +01:00
|
|
|
build-coverage/%.o: %.c | build-coverage
|
2021-01-29 20:54:04 +01:00
|
|
|
gcc -c $(CFLAGS_COVERAGE) $< -o $@
|
|
|
|
|
2021-06-12 12:03:02 +02:00
|
|
|
build-coverage/%.o: %.cpp | build-coverage
|
|
|
|
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
|
2020-12-01 22:13:09 +01:00
|
|
|
|
2021-06-12 12:03:02 +02:00
|
|
|
build-asan/%.o: %.c | build-asan
|
2021-01-29 20:54:04 +01:00
|
|
|
gcc -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
2021-06-12 12:03:02 +02:00
|
|
|
build-asan/%.o: %.cpp | build-asan
|
|
|
|
${CC} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
2020-12-01 22:13:09 +01:00
|
|
|
|
2021-01-29 20:54:04 +01:00
|
|
|
build-coverage/security_manager: ${COMMON_OBJ_COVERAGE} build-coverage/security_manager.o | build-coverage
|
2020-12-01 22:13:09 +01:00
|
|
|
${CC} $^ ${LDFLAGS_COVERAGE} -o $@
|
|
|
|
|
2021-01-29 20:54:04 +01:00
|
|
|
build-asan/security_manager: ${COMMON_OBJ_ASAN} build-asan/security_manager.o | build-asan
|
2020-12-01 22:13:09 +01:00
|
|
|
${CC} $^ ${LDFLAGS_ASAN} -o $@
|
2014-04-11 15:14:38 +00:00
|
|
|
|
|
|
|
|
2015-07-03 11:18:03 +02:00
|
|
|
test: all
|
2020-12-01 22:13:09 +01:00
|
|
|
build-asan/security_manager
|
2015-05-17 18:07:24 +02:00
|
|
|
|
2020-11-30 21:35:42 +01:00
|
|
|
coverage: all
|
2020-12-01 22:13:09 +01:00
|
|
|
rm -f build-coverage/*.gcda
|
2020-11-30 21:35:42 +01:00
|
|
|
build-coverage/security_manager
|
|
|
|
|
2014-04-11 15:14:38 +00:00
|
|
|
clean:
|
2020-12-01 22:13:09 +01:00
|
|
|
rm -rf build-coverage build-asan
|