From dadaace394f1e5ffe1658f55c9926a8b3fc4434f Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Tue, 30 Nov 2021 12:24:43 +0100 Subject: [PATCH] sys/log: check that one and only one backend --- sys/log/Makefile.include | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/log/Makefile.include b/sys/log/Makefile.include index 530c972f11..b9d4614145 100644 --- a/sys/log/Makefile.include +++ b/sys/log/Makefile.include @@ -1,3 +1,15 @@ +# check that one, and only one log backend is being used +USED_LOG_BACKENDS := $(sort $(filter log_%,$(USEMODULE))) + +ifeq (0,$(words $(USED_LOG_BACKENDS))) + $(error The log module is being used but no backend is provided.) +else ifeq (1,$(words $(USED_LOG_BACKENDS))) + # only one backend is provided, this is correct +else + $(info Only one log backend can be used at a time.) + $(error Currently selecting: $(USED_LOG_BACKENDS)) +endif + ifneq (,$(filter log_printfnoformat,$(USEMODULE))) USEMODULE_INCLUDES += $(RIOTBASE)/sys/log/log_printfnoformat endif