Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] core/printvars: allow dumping a set of variables
@ 2015-11-04 19:40 Yann E. MORIN
  2015-11-04 20:45 ` Thomas Petazzoni
  2015-11-04 21:41 ` Arnout Vandecappelle
  0 siblings, 2 replies; 4+ messages in thread
From: Yann E. MORIN @ 2015-11-04 19:40 UTC (permalink / raw)
  To: buildroot

Dumping our 176164 variables can take quite some time (~12s here). What
takes the most time is sorting the variables (~9s), followed by the
parsing of our Makefiles (~3s), with the actual printing in the noise.

However, sometimes only one or a few variables are needed. For example,
one may want to retrieve the Linux build dir from a post-build hook (to
get the Linux' actual .config after our fixups and check for various
features).

Add the possibility to only dump the variables listed in $(VAR) which
must be passed as a make argument, like so:

    $ make -s printvars VARS="LINUX_DIR TOPDIR O"
    LINUX_DIR=/home/ymorin/dev/buildroot/O/build/linux-4.3 ($(BUILD_DIR)/$(LINUX_BASE_NAME))
    O=/home/ymorin/dev/buildroot/O/. (/home/ymorin/dev/buildroot/O/.)
    TOPDIR=/home/ymorin/dev/buildroot/buildroot (/home/ymorin/dev/buildroot/buildroot)

This is much faster (the time is just about the time it takes to parse
our Makefiles, 3s here) and easier to parse.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6d34ee2..7b152c7 100644
--- a/Makefile
+++ b/Makefile
@@ -832,9 +832,10 @@ ifeq ($(NEED_WRAPPER),y)
 endif
 
 # printvars prints all the variables currently defined in our Makefiles
+# or only the variables specified in $(VARS)
 printvars:
 	@$(foreach V, \
-		$(sort $(.VARIABLES)), \
+		$(sort $(if $(VARS),$(VARS),$(.VARIABLES))), \
 		$(if $(filter-out environment% default automatic, \
 				$(origin $V)), \
 		$(info $V=$($V) ($(value $V)))))
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] core/printvars: allow dumping a set of variables
  2015-11-04 19:40 [Buildroot] [PATCH] core/printvars: allow dumping a set of variables Yann E. MORIN
@ 2015-11-04 20:45 ` Thomas Petazzoni
  2015-11-04 20:58   ` Yann E. MORIN
  2015-11-04 21:41 ` Arnout Vandecappelle
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2015-11-04 20:45 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Wed,  4 Nov 2015 20:40:42 +0100, Yann E. MORIN wrote:
> Dumping our 176164 variables can take quite some time (~12s here). What
> takes the most time is sorting the variables (~9s), followed by the
> parsing of our Makefiles (~3s), with the actual printing in the noise.
> 
> However, sometimes only one or a few variables are needed. For example,
> one may want to retrieve the Linux build dir from a post-build hook (to
> get the Linux' actual .config after our fixups and check for various
> features).
> 
> Add the possibility to only dump the variables listed in $(VAR) which
> must be passed as a make argument, like so:
> 
>     $ make -s printvars VARS="LINUX_DIR TOPDIR O"
>     LINUX_DIR=/home/ymorin/dev/buildroot/O/build/linux-4.3 ($(BUILD_DIR)/$(LINUX_BASE_NAME))
>     O=/home/ymorin/dev/buildroot/O/. (/home/ymorin/dev/buildroot/O/.)
>     TOPDIR=/home/ymorin/dev/buildroot/buildroot (/home/ymorin/dev/buildroot/buildroot)
> 
> This is much faster (the time is just about the time it takes to parse
> our Makefiles, 3s here) and easier to parse.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

I haven't thought about the implementation, but it possible to support
wildcards, like LIBFOO_* or LIBFOO_% ?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] core/printvars: allow dumping a set of variables
  2015-11-04 20:45 ` Thomas Petazzoni
@ 2015-11-04 20:58   ` Yann E. MORIN
  0 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2015-11-04 20:58 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2015-11-04 21:45 +0100, Thomas Petazzoni spake thusly:
> On Wed,  4 Nov 2015 20:40:42 +0100, Yann E. MORIN wrote:
> > Dumping our 176164 variables can take quite some time (~12s here). What
> > takes the most time is sorting the variables (~9s), followed by the
> > parsing of our Makefiles (~3s), with the actual printing in the noise.
> > 
> > However, sometimes only one or a few variables are needed. For example,
> > one may want to retrieve the Linux build dir from a post-build hook (to
> > get the Linux' actual .config after our fixups and check for various
> > features).
> > 
> > Add the possibility to only dump the variables listed in $(VAR) which
> > must be passed as a make argument, like so:
> > 
> >     $ make -s printvars VARS="LINUX_DIR TOPDIR O"
> >     LINUX_DIR=/home/ymorin/dev/buildroot/O/build/linux-4.3 ($(BUILD_DIR)/$(LINUX_BASE_NAME))
> >     O=/home/ymorin/dev/buildroot/O/. (/home/ymorin/dev/buildroot/O/.)
> >     TOPDIR=/home/ymorin/dev/buildroot/buildroot (/home/ymorin/dev/buildroot/buildroot)
> > 
> > This is much faster (the time is just about the time it takes to parse
> > our Makefiles, 3s here) and easier to parse.
> > 
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> I haven't thought about the implementation, but it possible to support
> wildcards, like LIBFOO_* or LIBFOO_% ?

I'll look at it...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] core/printvars: allow dumping a set of variables
  2015-11-04 19:40 [Buildroot] [PATCH] core/printvars: allow dumping a set of variables Yann E. MORIN
  2015-11-04 20:45 ` Thomas Petazzoni
@ 2015-11-04 21:41 ` Arnout Vandecappelle
  1 sibling, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-11-04 21:41 UTC (permalink / raw)
  To: buildroot

On 04-11-15 20:40, Yann E. MORIN wrote:
> Dumping our 176164 variables can take quite some time (~12s here). What
> takes the most time is sorting the variables (~9s), followed by the
> parsing of our Makefiles (~3s), with the actual printing in the noise.
> 
> However, sometimes only one or a few variables are needed. For example,
> one may want to retrieve the Linux build dir from a post-build hook (to
> get the Linux' actual .config after our fixups and check for various
> features).
> 
> Add the possibility to only dump the variables listed in $(VAR) which
> must be passed as a make argument, like so:
> 
>     $ make -s printvars VARS="LINUX_DIR TOPDIR O"
>     LINUX_DIR=/home/ymorin/dev/buildroot/O/build/linux-4.3 ($(BUILD_DIR)/$(LINUX_BASE_NAME))
>     O=/home/ymorin/dev/buildroot/O/. (/home/ymorin/dev/buildroot/O/.)
>     TOPDIR=/home/ymorin/dev/buildroot/buildroot (/home/ymorin/dev/buildroot/buildroot)
> 
> This is much faster (the time is just about the time it takes to parse
> our Makefiles, 3s here) and easier to parse.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 I was going to say you forgot to update the documentation, but there isn't any...

 Regards,
 Arnout

> ---
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 6d34ee2..7b152c7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -832,9 +832,10 @@ ifeq ($(NEED_WRAPPER),y)
>  endif
>  
>  # printvars prints all the variables currently defined in our Makefiles
> +# or only the variables specified in $(VARS)
>  printvars:
>  	@$(foreach V, \
> -		$(sort $(.VARIABLES)), \
> +		$(sort $(if $(VARS),$(VARS),$(.VARIABLES))), \
>  		$(if $(filter-out environment% default automatic, \
>  				$(origin $V)), \
>  		$(info $V=$($V) ($(value $V)))))
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-04 21:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04 19:40 [Buildroot] [PATCH] core/printvars: allow dumping a set of variables Yann E. MORIN
2015-11-04 20:45 ` Thomas Petazzoni
2015-11-04 20:58   ` Yann E. MORIN
2015-11-04 21:41 ` Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox