[Buildroot] [git commit branch/2022.02.x] Makefile: error out printvars target when VARS is empty or unset

Peter Korsgaard peter at korsgaard.com
Wed Sep 14 09:25:59 UTC 2022


commit: https://git.buildroot.net/buildroot/commit/?id=c47f728a78a54eb9f8c0e5df9029fddace8af32b
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2022.02.x

printvars returns nothing when VARS is not passed or empty. This is done
on purpose, see commit fd5bd12379dc ("Makefile: printvars: don't print
anything when VARS is not set").

An error message making explicit what is required from the user in order
to use printvars is however better than silently doing nothing.

This adds a check for a non-empty VARS variable.

Cc: Quentin Schulz <foss+buildroot at 0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
(cherry picked from commit ec82347cdee190a5fa451b83cdb3727c78cda315)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index c39df4c58b..aa6c11acec 100644
--- a/Makefile
+++ b/Makefile
@@ -1061,6 +1061,10 @@ endif
 # to workaround a bug in make 4.3; see https://savannah.gnu.org/bugs/?59093
 .PHONY: printvars
 printvars:
+ifndef VARS
+	@echo "Please pass a non-empty VARS to 'make printvars'"
+	@exit 1
+endif
 	@:
 	$(foreach V, \
 		$(sort $(foreach X, $(.VARIABLES), $(filter $(VARS),$(X)))), \



More information about the buildroot mailing list