diff mbox

Makefile: fix performance regression introduced by "Makefile: don't depend on the umask"

Message ID 1437084210-25086-1-git-send-email-arnout@mind.be
State Superseded
Headers show

Commit Message

Arnout Vandecappelle July 16, 2015, 10:03 p.m. UTC
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.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Guido Martínez <guido@vanguardiasur.com.a>
---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index c7d6bee..b4ef2fa 100644
--- a/Makefile
+++ b/Makefile
@@ -29,11 +29,11 @@  UMASK=0022
 ifneq ($(shell umask),$(UMASK))
 .PHONY: all $(MAKECMDGOALS)
 
-all:
-	@umask $(UMASK) && $(MAKE) --no-print-directory
+_all:
+	@umask $(UMASK) && $(MAKE) --no-print-directory $(MAKEARGS) $(MAKECMDGOALS)
 
-$(MAKECMDGOALS):
-	@umask $(UMASK) && $(MAKE) --no-print-directory $@
+$(MAKECMDGOALS): _all
+	@:
 
 else # umask