Makefile: fix performance regression casued by the umask handling
PATCH v4 1/1 Makefile: fix performance regression casued by the umask handling
From: Guido Mart?nez <[email protected]>
Commit bee5745c introduced an extra level of 'make' when the umask is different from 0022. However, when several targets were specified on the command line, a new make instance would be called for each target. This introduces a huge performance overhead when many targets are specified on the command line.
To fix this, use the same approach as used in the mkmakefile script:
an addition target on which the MAKECMDGOALS depend, so that this target is run only once.
Note that the mkmakefile script contains a special exception for Makefile, because the Makefile in the output directory is generated. Since the top-level Makefile is not generated, this exception is not needed here.
While we're at it, also fix the whitespace in the UMASK assignment.
---
Changes v0 -> v4:
- aggregate Arnout's and Guido's patches together, keepign the best of both patches
- fix the spaces in UMASK assignment
--- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Makefile +6 -6
@@ -25,15 +25,15 @@ #-------------------------------------------------------------- # Trick for always running with a fixed umask -UMASK=0022 +UMASK = 0022 ifneq ($(shell umask),$(UMASK)) -.PHONY: all $(MAKECMDGOALS) +.PHONY: _all $(MAKECMDGOALS) -all: - @umask $(UMASK) && $(MAKE) --no-print-directory +$(MAKECMDGOALS): _all + @: -$(MAKECMDGOALS): - @umask $(UMASK) && $(MAKE) --no-print-directory $@ +_all: + @umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS) else # umask
Signature · 1 line
1.9.1
PATCH v4 1/1 Makefile: fix performance regression casued by the umask handling
Quoted 17 lines · Yann E. MORIN
From: Guido Mart?nez <[email protected]>
Commit
bee5745cintroduced an extra level of 'make' when the umask is different from 0022. However, when several targets were specified on the command line, a new make instance would be called for each target. This introduces a huge performance overhead when many targets are specified on the command line.To fix this, use the same approach as used in the mkmakefile script:
an addition target on which the MAKECMDGOALS depend, so that this target is run only once.Note that the mkmakefile script contains a special exception for
Makefile, because theMakefilein the output directory is generated. Since the top-levelMakefileis not generated, this exception is not needed here.
Quoted 6 lines
While we're at it, also fix the whitespace in the UMASK assignment.
Signed-off-by Guido Mart?nez <[email protected]>[yann.morin.1998 at free.fr: aggregate patches from Arnout and Guido]Signed-off-by Yann E. MORIN <[email protected]>
Someone finally got it right :-)
Sorry for all the spam...
Regards,
Arnout
Quoted 37 lines
---
Changes v0 -> v4:
- aggregate Arnout's and Guido's patches together, keepign the best of both patches
- fix the spaces in UMASK assignment--- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)Makefile +6
-6@@ -25,15 +25,15 @@ #-------------------------------------------------------------- # Trick for always running with a fixed umask -UMASK=0022 +UMASK = 0022 ifneq ($(shell umask),$(UMASK)) -.PHONY: all $(MAKECMDGOALS) +.PHONY: _all $(MAKECMDGOALS) -all: - @umask $(UMASK) && $(MAKE) --no-print-directory +$(MAKECMDGOALS): _all + @: -$(MAKECMDGOALS): - @umask $(UMASK) && $(MAKE) --no-print-directory $@ +_all: + @umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS) else # umask
Signature · 6 lines
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
PATCH v4 1/1 Makefile: fix performance regression casued by the umask handling
Arnout, Guido, All,
On 2015-07-17 00:35 +0200, Arnout Vandecappelle spake thusly:
Quoted 20 lines · Yann E. MORIN
Quoted 19 lines
From: Guido Mart?nez <[email protected]>
Commit
bee5745cintroduced an extra level of 'make' when the umask is different from 0022. However, when several targets were specified on the command line, a new make instance would be called for each target. This introduces a huge performance overhead when many targets are specified on the command line.To fix this, use the same approach as used in the mkmakefile script:
an addition target on which the MAKECMDGOALS depend, so that this target is run only once.Note that the mkmakefile script contains a special exception for
Makefile, because theMakefilein the output directory is generated. Since the top-levelMakefileis not generated, this exception is not needed here.While we're at it, also fix the whitespace in the UMASK assignment.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Guido Mart?nez <[email protected]>[yann.morin.1998 at free.fr: aggregate patches from Arnout and Guido]Signed-off-by Yann E. MORIN <[email protected]>Someone finally got it right :-)
Almost... I made a typo in the subject... ;-]
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
Thomas Petazzoni
AppliedPATCH v4 1/1 Makefile: fix performance regression casued by the umask handling
In reply to Yann E. MORINDear Yann E. MORIN,
Quoted 24 lines · Yann E. MORIN
From: Guido Mart?nez <[email protected]>
Commit
bee5745cintroduced an extra level of 'make' when the umask is different from 0022. However, when several targets were specified on the command line, a new make instance would be called for each target. This introduces a huge performance overhead when many targets are specified on the command line.To fix this, use the same approach as used in the mkmakefile script:
an addition target on which the MAKECMDGOALS depend, so that this target is run only once.Note that the mkmakefile script contains a special exception for
Makefile, because theMakefilein the output directory is generated. Since the top-levelMakefileis not generated, this exception is not needed here.While we're at it, also fix the whitespace in the UMASK assignment.
Signed-off-by Guido Mart?nez <[email protected]>[yann.morin.1998 at free.fr: aggregate patches from Arnout and Guido]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 8 lines
---
Changes v0 -> v4:
- aggregate Arnout's and Guido's patches together, keepign the best of both patches
- fix the spaces in UMASK assignment--- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Applied, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com