diff mbox series

Makefile: error out printvars target when VARS is empty or unset

Message ID 20220802123559.2514433-1-foss+buildroot@0leil.net
State Accepted
Headers show
Series Makefile: error out printvars target when VARS is empty or unset | expand

Commit Message

Quentin Schulz Aug. 2, 2022, 12:35 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

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@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Yann E. MORIN Aug. 3, 2022, 5:07 p.m. UTC | #1
Quentin, All,

On 2022-08-02 14:35 +0200, Quentin Schulz spake thusly:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> 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@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index a743e42f91..3cbcfa9196 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1058,6 +1058,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)))), \
> -- 
> 2.37.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Peter Korsgaard Sept. 14, 2022, 9:29 a.m. UTC | #2
>>>>> "Quentin" == Quentin Schulz <foss+buildroot@0leil.net> writes:

 > From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
 > 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@0leil.net>
 > Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Committed to 2022.05.x and 2022.02.x, thanks.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index a743e42f91..3cbcfa9196 100644
--- a/Makefile
+++ b/Makefile
@@ -1058,6 +1058,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)))), \