From 166ed18939ecd6201b92f213aef9fad0fa7461bc Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Tue, 28 May 2019 10:43:17 +0200 Subject: [PATCH] make: add LOG_LEVEL to overridable variables --- Makefile.include | 8 ++++++++ makefiles/vars.inc.mk | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Makefile.include b/Makefile.include index 9e8e8f78f8..f9ed21b6a1 100644 --- a/Makefile.include +++ b/Makefile.include @@ -141,6 +141,14 @@ ifeq ($(DEVELHELP),1) CFLAGS += -DDEVELHELP endif +# Override LOG_LEVEL if variable is set and if CFLAGS doesn't already contain +# a LOG_LEVEL config +ifdef LOG_LEVEL + ifneq (,$(filter -DLOG_LEVEL=%,$(CFLAGS))) + CFLAGS += -DLOG_LEVEL=$(LOG_LEVEL) + endif +endif + # Fail on warnings. Can be overridden by `make WERROR=0`. WERROR ?= 1 export WERROR diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index f2c5ac9ed0..b46d5f70b5 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -95,3 +95,5 @@ export UNZIP_HERE # Use `cd $(SOME_FOLDER) && $(UNZIP_HERE) $(SOME_FI export LAZYSPONGE # Command saving stdin to a file only on content update. export LAZYSPONGE_FLAGS # Parameters supplied to LAZYSPONGE. + +# LOG_LEVEL # Logging level as integer (NONE: 0, ERROR: 1, WARNING: 2, INFO: 3, DEBUG: 4, default: 3)