[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 2/2] [ng] subdirs: use static pattern rules to defi
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 2/2] [ng] subdirs: use static pattern rules to define *-recursive targets |
Date: |
Fri, 15 Jun 2012 16:04:11 +0200 |
* lib/am/subdirs.am ($(RECURSIVE_TARGETS), $(RECURSIVE_CLEAN_TARGETS)):
Rewrite as static pattern rules. This will also simplify their recipes,
avoid extra processing by the shell, and shave off a couple of forks.
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/am/subdirs.am | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am
index 5dfe8ca..98a7010 100644
--- a/lib/am/subdirs.am
+++ b/lib/am/subdirs.am
@@ -31,7 +31,7 @@ AM_RECURSIVE_TARGETS += $(RECURSIVE_TARGETS:-recursive=) \
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
-$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): %-recursive:
## Using $failcom allows "-k" to keep its natural meaning when running a
## recursive rule.
@fail= failcom='exit 1'; \
@@ -42,7 +42,6 @@ $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
esac; \
done; \
dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
## For distclean and maintainer-clean we make sure to use the full
## list of subdirectories. We do this so that 'configure; make
## distclean' really is a no-op, even if SUBDIRS is conditional.
@@ -51,17 +50,17 @@ $(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
+ echo "Making $* in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
- local_target="$$target-am"; \
+ local_target=$*-am; \
else \
- local_target="$$target"; \
+ local_target=$*; \
fi; \
$(MAKE) -C "$$subdir" $$local_target || eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
- $(MAKE) "$$target-am" || exit 1; \
+ $(MAKE) $*-am || exit 1; \
fi; test -z "$$fail"
--
1.7.9.5