2015-08-07 19:45:00 +00:00
|
|
|
# Makefile for libusb based PTS tests
|
2022-03-11 21:15:38 +00:00
|
|
|
|
2015-08-07 19:45:00 +00:00
|
|
|
BTSTACK_ROOT = ../..
|
2015-11-13 14:04:41 +00:00
|
|
|
POSIX_ROOT= ${BTSTACK_ROOT}/platform/posix
|
2023-08-20 14:13:49 +00:00
|
|
|
|
|
|
|
# CppuTest from pkg-config
|
|
|
|
CFLAGS += ${shell pkg-config --cflags CppuTest}
|
|
|
|
LDFLAGS += ${shell pkg-config --libs CppuTest}
|
2015-08-07 19:45:00 +00:00
|
|
|
|
2016-02-19 08:46:37 +00:00
|
|
|
include ${BTSTACK_ROOT}/example/Makefile.inc
|
2015-12-02 09:51:57 +00:00
|
|
|
|
2015-08-07 19:45:00 +00:00
|
|
|
COMMON = \
|
2017-05-17 21:22:05 +00:00
|
|
|
ad_parser.c \
|
|
|
|
sdp_server.c \
|
|
|
|
sdp_client_rfcomm.c \
|
2016-02-03 20:55:36 +00:00
|
|
|
btstack_link_key_db_memory.c \
|
2017-05-17 21:22:05 +00:00
|
|
|
btstack_linked_list.c \
|
|
|
|
btstack_memory.c \
|
|
|
|
btstack_memory_pool.c \
|
|
|
|
btstack_run_loop.c \
|
|
|
|
btstack_run_loop_posix.c \
|
|
|
|
btstack_util.c \
|
|
|
|
hci.c \
|
|
|
|
hci_cmd.c \
|
|
|
|
hci_dump.c \
|
|
|
|
l2cap.c \
|
|
|
|
l2cap_signaling.c \
|
|
|
|
rfcomm.c \
|
|
|
|
sdp_client.c \
|
|
|
|
sdp_util.c \
|
2015-08-07 19:45:00 +00:00
|
|
|
|
|
|
|
|
2015-08-26 16:31:31 +00:00
|
|
|
MOCK = \
|
2016-01-06 16:31:20 +00:00
|
|
|
mock.c \
|
|
|
|
test_sequences.c \
|
2016-02-03 20:55:36 +00:00
|
|
|
btstack_link_key_db_memory.c \
|
2016-01-20 15:23:34 +00:00
|
|
|
btstack_linked_list.c \
|
2015-08-26 16:31:31 +00:00
|
|
|
btstack_memory.c \
|
2016-02-03 20:55:36 +00:00
|
|
|
btstack_memory_pool.c \
|
|
|
|
btstack_util.c \
|
2016-01-21 10:33:17 +00:00
|
|
|
hci_cmd.c \
|
2015-08-26 16:31:31 +00:00
|
|
|
hci_dump.c \
|
|
|
|
sdp_util.c \
|
2020-11-30 20:35:42 +00:00
|
|
|
|
2023-08-20 14:13:49 +00:00
|
|
|
CFLAGS += -DUNIT_TEST -g -Wall -Wnarrowing -Wconversion-null
|
2021-06-12 10:03:02 +00:00
|
|
|
CFLAGS += -I. -I../
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/src
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/src/classic
|
|
|
|
CFLAGS += -I${BTSTACK_ROOT}/platform/posix
|
2020-12-01 21:13:09 +00:00
|
|
|
# CFLAGS += -D OCTAVE_OUTPUT
|
|
|
|
|
|
|
|
CFLAGS_COVERAGE = ${CFLAGS} -fprofile-arcs -ftest-coverage
|
2021-01-29 20:47:15 +00:00
|
|
|
CFLAGS_ASAN = ${CFLAGS} -fsanitize=address -DHAVE_ASSERT
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
LDFLAGS += -lCppUTest -lCppUTestExt
|
|
|
|
LDFLAGS_COVERAGE = ${LDFLAGS} -fprofile-arcs -ftest-coverage
|
|
|
|
LDFLAGS_ASAN = ${LDFLAGS} -fsanitize=address
|
|
|
|
|
|
|
|
COMMON_OBJ_COVERAGE = $(addprefix build-coverage/,$(COMMON:.c=.o))
|
|
|
|
COMMON_OBJ_ASAN = $(addprefix build-asan/, $(COMMON:.c=.o))
|
|
|
|
MOCK_OBJ_COVERAGE = $(addprefix build-coverage/,$(MOCK:.c=.o))
|
|
|
|
MOCK_OBJ_ASAN = $(addprefix build-asan/, $(MOCK:.c=.o))
|
|
|
|
|
2015-08-07 19:45:00 +00:00
|
|
|
|
|
|
|
# CC = gcc-fsf-4.9
|
|
|
|
VPATH += ${BTSTACK_ROOT}/src
|
2015-11-13 14:04:41 +00:00
|
|
|
VPATH += ${BTSTACK_ROOT}/src/classic
|
2016-01-20 13:20:47 +00:00
|
|
|
VPATH += ${BTSTACK_ROOT}/platform/posix
|
2015-08-07 19:45:00 +00:00
|
|
|
|
2020-11-30 20:35:42 +00:00
|
|
|
EXAMPLES = hfp_at_parser_test hfp_ag_client_test hfp_hf_client_test cvsd_plc_test hfp_link_settings_test
|
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
all: $(addprefix build-coverage/,${EXAMPLES}) $(addprefix build-asan/,${EXAMPLES}) build-asan/pklg_cvsd_test
|
2015-08-07 19:45:00 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-%:
|
|
|
|
mkdir -p $@
|
2015-08-07 19:45:00 +00:00
|
|
|
|
|
|
|
|
2020-11-30 20:35:42 +00:00
|
|
|
build-coverage/%.o: %.c | build-coverage
|
2020-12-01 21:13:09 +00:00
|
|
|
${CC} -c $(CFLAGS_COVERAGE) $< -o $@
|
2015-08-20 15:06:54 +00:00
|
|
|
|
2022-03-11 21:15:38 +00:00
|
|
|
build-coverage/%.o: %.cpp | build-coverage
|
|
|
|
${CXX} -c $(CFLAGS_COVERAGE) $< -o $@
|
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-asan/%.o: %.c | build-asan
|
|
|
|
${CC} -c $(CFLAGS_ASAN) $< -o $@
|
2015-08-26 16:31:31 +00:00
|
|
|
|
2022-03-11 21:15:38 +00:00
|
|
|
build-asan/%.o: %.cpp | build-asan
|
|
|
|
${CXX} -c $(CFLAGS_ASAN) $< -o $@
|
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-coverage/hfp_at_parser_test: ${COMMON_OBJ_COVERAGE} build-coverage/hfp_gsm_model.o build-coverage/hfp_ag.o build-coverage/hfp.o build-coverage/hfp_at_parser_test.o | build-coverage
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
|
2015-09-23 14:58:34 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-coverage/hfp_hf_client_test: ${MOCK_OBJ_COVERAGE} build-coverage/hfp_hf.o build-coverage/hfp.o build-coverage/hfp_hf_client_test.o | build-coverage
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
|
2016-08-29 21:10:32 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-coverage/hfp_ag_client_test: ${MOCK_OBJ_COVERAGE} build-coverage/hfp_gsm_model.o build-coverage/hfp_ag.o build-coverage/hfp.o build-coverage/hfp_ag_client_test.o | build-coverage
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
|
2018-12-17 13:34:33 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-coverage/cvsd_plc_test: ${COMMON_OBJ_COVERAGE} build-coverage/btstack_cvsd_plc.o build-coverage/wav_util.o build-coverage/cvsd_plc_test.o | build-coverage
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
|
2020-09-08 15:17:55 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
build-coverage/hfp_link_settings_test: ${MOCK_OBJ_COVERAGE} build-coverage/hfp_hf.o build-coverage/hfp.o build-coverage/hfp_link_settings_test.o | build-coverage
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_COVERAGE} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
build-asan/hfp_at_parser_test: ${COMMON_OBJ_ASAN} build-asan/hfp_gsm_model.o build-asan/hfp_ag.o build-asan/hfp.o build-asan/hfp_at_parser_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
build-asan/hfp_hf_client_test: ${MOCK_OBJ_ASAN} build-asan/hfp_hf.o build-asan/hfp.o build-asan/hfp_hf_client_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
build-asan/hfp_ag_client_test: ${MOCK_OBJ_ASAN} build-asan/hfp_gsm_model.o build-asan/hfp_ag.o build-asan/hfp.o build-asan/hfp_ag_client_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
build-asan/cvsd_plc_test: ${COMMON_OBJ_ASAN} build-asan/btstack_cvsd_plc.o build-asan/wav_util.o build-asan/cvsd_plc_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
build-asan/hfp_link_settings_test: ${MOCK_OBJ_ASAN} build-asan/hfp_hf.o build-asan/hfp.o build-asan/hfp_link_settings_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2020-12-01 21:13:09 +00:00
|
|
|
|
|
|
|
build-asan/pklg_cvsd_test: build-asan/hci_dump.o build-asan/btstack_util.o build-asan/btstack_cvsd_plc.o build-asan/wav_util.o build-asan/pklg_cvsd_test.o | build-asan
|
2022-03-11 21:15:38 +00:00
|
|
|
${CXX} $^ ${LDFLAGS_ASAN} -o $@
|
2020-11-30 20:35:42 +00:00
|
|
|
|
2015-08-20 15:06:54 +00:00
|
|
|
test: all
|
2016-11-16 10:21:23 +00:00
|
|
|
mkdir -p results
|
2020-12-01 21:13:09 +00:00
|
|
|
build-asan/hfp_at_parser_test
|
|
|
|
build-asan/hfp_ag_client_test
|
|
|
|
build-asan/hfp_hf_client_test
|
|
|
|
build-asan/cvsd_plc_test
|
|
|
|
build-asan/hfp_link_settings_test
|
2020-11-30 20:35:42 +00:00
|
|
|
|
|
|
|
coverage: all
|
|
|
|
mkdir -p results
|
|
|
|
build-coverage/hfp_at_parser_test
|
|
|
|
build-coverage/hfp_ag_client_test
|
|
|
|
build-coverage/hfp_hf_client_test
|
|
|
|
build-coverage/cvsd_plc_test
|
|
|
|
build-coverage/hfp_link_settings_test
|
2018-12-17 13:34:33 +00:00
|
|
|
|
2020-12-01 21:13:09 +00:00
|
|
|
pklg-test: build-asan/pklg_cvsd_test
|
|
|
|
build-asan/pklg_cvsd_test pklg/test1
|
|
|
|
build-asan/pklg_cvsd_test pklg/test2
|
|
|
|
build-asan/pklg_cvsd_test pklg/test3
|
|
|
|
build-asan/pklg_cvsd_test pklg/test4
|
|
|
|
build-asan/pklg_cvsd_test pklg/test5
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf build-coverage build-asan
|
|
|
|
rm -rf *.wav results/* pklg/*.wav
|