Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Makefile: optimize umask setting
Date: Fri, 17 Jul 2015 00:09:11 +0200	[thread overview]
Message-ID: <55A82B87.6030808@mind.be> (raw)
In-Reply-To: <1437083717-2736-1-git-send-email-guido@vanguardiasur.com.ar>

On 07/16/15 23:55, Guido Mart?nez wrote:
> When using make to build multiple targets ("make a b ..."), the makefile
> would get called individually for each target, making the build a lot
> slower since every Makefile in BR's tree was parsed each time.
> 
> Fix this by making every invoked target depend on an "_all" rule, and
> doing the real work there, only one time. This is similar to the logic
> used in the generated makefile (support/scripts/mkmakefile).
> 
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> ---
>  Makefile | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 531ac5d..f50f767 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -27,13 +27,13 @@
>  # Trick for always running with a fixed umask
>  UMASK=0022
>  ifneq ($(shell umask),$(UMASK))
> -.PHONY: all $(MAKECMDGOALS)
> +.PHONY: _all

 $(MAKECMDGOALS) should still be .PHONY (the non-phony targets are only
non-phony on the next level of make invocation).

 But in my patch, I forgot to replace all by _all :-)

>  
> -all:
> -	@umask $(UMASK) && $(MAKE) --no-print-directory
> +$(MAKECMDGOALS): _all
> +	@:
>  
> -$(MAKECMDGOALS):
> -	@umask $(UMASK) && $(MAKE) --no-print-directory $@
> +_all:
> +	@umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS)

 That's indeed a more logical order.

 mkmakefile also adds $(MAKEARGS) - should we keep that?

 Regards,
 Arnout

>  
>  else # umask
>  
> 


-- 
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

  reply	other threads:[~2015-07-16 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 10:57 [Buildroot] [git commit] Makefile: don't depend on the umask Thomas Petazzoni
2015-07-16 20:52 ` [Buildroot] Major regression introduced by "Makefile: don't depend on the umask" Thomas Petazzoni
2015-07-16 21:55   ` [Buildroot] [PATCH] Makefile: optimize umask setting Guido Martínez
2015-07-16 22:09     ` Arnout Vandecappelle [this message]
2015-07-16 22:03   ` [Buildroot] [PATCH] Makefile: fix performance regression introduced by "Makefile: don't depend on the umask" Arnout Vandecappelle
2015-07-16 22:19     ` Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55A82B87.6030808@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox