diff mbox series

Makefile: make printvars target print all variables if no VARS set

Message ID 20220801133041.2150607-1-foss+buildroot@0leil.net
State Rejected
Headers show
Series Makefile: make printvars target print all variables if no VARS set | expand

Commit Message

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

VARS is not defined by default, meaning the filter will not return
anything which ends up making `make printvars` also return nothing.

Fix this by setting VARS to '%' - which is the match-all pattern - in
printvars using a conditional variable assignment operator, such as
what's currently done for show-vars.

Fixes: 5c54c3ef3db2 ("Makefile: workaround make 4.3 issue for 'printvars and 'show-vars'")
Cc: Quentin Schulz <foss+buildroot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

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

On 2022-08-01 15:30 +0200, Quentin Schulz spake thusly:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> VARS is not defined by default, meaning the filter will not return
> anything which ends up making `make printvars` also return nothing.

In fact, this is the expected behaviour, see fd5bd12379dc (Makefile:
printvars: don't print anything when VARS is not set).

> Fix this by setting VARS to '%' - which is the match-all pattern - in
> printvars using a conditional variable assignment operator, such as
> what's currently done for show-vars.

And see da4cb17aa165 (Makefile: introduce show-vars, a json-formatted
equivalent to printvars) for the reason why show-vars defaults to VAR=%

So, I've marked this patch as rejected.

Regards,
Yann E. MORIN.

> Fixes: 5c54c3ef3db2 ("Makefile: workaround make 4.3 issue for 'printvars and 'show-vars'")
> Cc: Quentin Schulz <foss+buildroot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile b/Makefile
> index a743e42f91..f1b5494726 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1057,6 +1057,7 @@ endif
>  # Note: we iterate of .VARIABLES and filter each variable individually,
>  # to workaround a bug in make 4.3; see https://savannah.gnu.org/bugs/?59093
>  .PHONY: printvars
> +printvars: VARS?=%
>  printvars:
>  	@:
>  	$(foreach V, \
> -- 
> 2.37.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Quentin Schulz Aug. 1, 2022, 3:15 p.m. UTC | #2
Hi Yann,

On 8/1/22 17:12, Yann E. MORIN wrote:
> Quentin, All,
> 
> On 2022-08-01 15:30 +0200, Quentin Schulz spake thusly:
>> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>>
>> VARS is not defined by default, meaning the filter will not return
>> anything which ends up making `make printvars` also return nothing.
> 
> In fact, this is the expected behaviour, see fd5bd12379dc (Makefile:
> printvars: don't print anything when VARS is not set).
> 
>> Fix this by setting VARS to '%' - which is the match-all pattern - in
>> printvars using a conditional variable assignment operator, such as
>> what's currently done for show-vars.
> 
> And see da4cb17aa165 (Makefile: introduce show-vars, a json-formatted
> equivalent to printvars) for the reason why show-vars defaults to VAR=%
> 
> So, I've marked this patch as rejected.
> 

I should have made some research first it seems like :) Maybe we could 
print some error message if VARS is not set? In any case, unrelated to 
this patch.

Sorry for the noise.

Cheers,
Quentin
Yann E. MORIN Aug. 1, 2022, 4:10 p.m. UTC | #3
Quentin, All,

On 2022-08-01 17:15 +0200, Quentin Schulz spake thusly:
> On 8/1/22 17:12, Yann E. MORIN wrote:
> >On 2022-08-01 15:30 +0200, Quentin Schulz spake thusly:
> >>From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> >>VARS is not defined by default, meaning the filter will not return
> >>anything which ends up making `make printvars` also return nothing.
> >In fact, this is the expected behaviour, see fd5bd12379dc (Makefile:
> >printvars: don't print anything when VARS is not set).
> I should have made some research first it seems like :) Maybe we could print
> some error message if VARS is not set? In any case, unrelated to this patch.

Yeah, maybe... If you can come up with something that is not too ugly...
And don't forget to update the manual while at it. ;-]

> Sorry for the noise.

n.p.

Regards,
Yann E. MORIN.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index a743e42f91..f1b5494726 100644
--- a/Makefile
+++ b/Makefile
@@ -1057,6 +1057,7 @@  endif
 # Note: we iterate of .VARIABLES and filter each variable individually,
 # to workaround a bug in make 4.3; see https://savannah.gnu.org/bugs/?59093
 .PHONY: printvars
+printvars: VARS?=%
 printvars:
 	@:
 	$(foreach V, \