[sr-dev] git:master: Makefile:modules fixed usage of -jN flag for modules(_k, _s)

Marius Zbihlei marius.zbihlei at 1and1.ro
Fri Feb 5 10:25:06 CET 2010


Module: sip-router
Branch: master
Commit: 329e20e2a88b08f6c092d6db014a6a7f9ea67bb6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=329e20e2a88b08f6c092d6db014a6a7f9ea67bb6

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Thu Feb  4 15:06:54 2010 +0200

Makefile:modules fixed usage of -jN flag for modules(_k,_s)

Removed the @for construct (launched a new shell) with a @foreach construct which does a textual expansion
of the block in question (loop unrolling)

---

 Makefile       |   12 +-----------
 Makefile.rules |   10 ++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index b6dc645..272cff3 100644
--- a/Makefile
+++ b/Makefile
@@ -603,17 +603,7 @@ $(1)_target=$(prefix)/$(modules_dir)$(1)
 
 .PHONY: $(1)
 $(1): modules.lst
-	@for r in $($(1)) "" ; do \
-		if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \
-			$(call oecho, "" ;) \
-			$(call oecho, "" ;) \
-			if  $(MAKE) -C $$$$r $$(mk_params) || [ ${err_fail} != 1 ] ; then \
-				:; \
-			else \
-				exit 1; \
-			fi ; \
-		fi ; \
-	done; true
+	@$(foreach r,$($(1)),$(call module_make,$(r),$(mk_params)))
 
 .PHONY: $(1)-doc
 $(1)-doc: modules.lst
diff --git a/Makefile.rules b/Makefile.rules
index e2ba439..7b46ef3 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -76,6 +76,16 @@ quiet=verbose
 oecho=echo $(1)
 endif
 
+module_make=	if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \
+			$(call oecho, "" ;) \
+			$(call oecho, "" ;) \
+			if  $$(MAKE) -C $(1) $(2) || [ ${err_fail} != 1 ] ; then \
+				:; \
+			else \
+				exit 1; \
+			fi ; \
+		fi ;
+
 quote:= "
 escall= $(subst $$,\$$,$(subst $(quote),\$(quote),$1))
 exec_cmd= $(if $($(quiet)_cmd_$(1)),\




More information about the sr-dev mailing list