[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [FYI] [ng] header vars: remove function $(am__mkdir)
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [FYI] [ng] header vars: remove function $(am__mkdir) |
Date: |
Tue, 31 Jul 2012 19:09:07 +0200 |
That function expanded unconditionally to:
test -d $1 || $(MKDIR_P) $1
This formulation was supposed to help avoiding extra forks (due to the
leading "test -d" check), but it didn't actually do so. In fact, in the
situations '$(am__mkdir)' was most used (typically indirectly, through
other private variables like '$(am__ensure_target_dir_exists)') the
Makefile had already determined by other means (e.g., tricky uses of the
'$(wildcard)' built-in) that the relevant directory didn't exist and
thus *had* to be created, so the fork of $(MKDIR_P) has to happen anyway.
In fact, the use of '$(am__mkdir)' often ended up causing *more forks*,
because it eventually expanded to recipes like:
target: recipe
test -d non-existent || $(MKDIR_P) non-existent
... rest of the recipe ...
forcing make to spawn a shell to execute the first line of the recipe --
which, containing the shell metacharacters "||", couldn't be spawned
directly -- shell which in turn had to spawn $(MKDIR_P).
Whereas with a simpler
target: recipe
$(MKDIR_P) non-existent
... rest of the recipe ...
make would span $(MKDIR_P) directly itself, thus saving a shell execution
-- and speeding up the recipe.
* lib/am/header-vars.am (am__mkdir): Delete.
(am__ensure_dir_exists): Simply use $(MKDIR) directly.
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/am/header-vars.mk | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/am/header-vars.mk b/lib/am/header-vars.mk
index e86f5b3..0e0dab8 100644
--- a/lib/am/header-vars.mk
+++ b/lib/am/header-vars.mk
@@ -119,8 +119,6 @@ unexport CDPATH
# FIXME: maybe normalize/sanitize $(V)?
V ?= 0
-am__mkdir = test -d $1 || $(MKDIR_P) $1
-
# In a recipe, ensure the given directory exists, creating it if
# necessary; but tries to do so avoiding useless forks, stats, and
# extra recipe text (the latter is useful when doing "make V=1").
@@ -130,7 +128,7 @@ am__mkdir = test -d $1 || $(MKDIR_P) $1
# usage patterns, one of them should always be true in non-VPATH
# builds.
am__ensure_dir_exists = \
- $(if $(filter .,$1),:,$(if $(wildcard $1/),:,$(call am__mkdir,$1)))
+ $(if $(filter .,$1),:,$(if $(wildcard $1/),:,$(MKDIR_P) $1))
# Ensure the directory containing the target of the current recipe
# exists, by creating it if necessary.
--
1.7.12.rc0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Automake-NG] [FYI] [ng] header vars: remove function $(am__mkdir),
Stefano Lattarini <=