From: Stefano Lattarini Date: Sun, 10 Jun 2012 15:34:10 +0000 (+0200) Subject: [ng] subdirs: use static pattern rules to define *-recursive targets X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c2a9213839e9dbe65c1fe620b50fa17ddca0b5b;p=thirdparty%2Fautomake.git [ng] subdirs: use static pattern rules to define *-recursive targets * 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 --- diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am index 5dfe8ca84..98a7010f7 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"