Makefile:modules fixed usage of -jN flag for modules(_k,_s)
authorMarius Zbihlei <marius.zbihlei@1and1.ro>
Thu, 4 Feb 2010 13:06:54 +0000 (15:06 +0200)
committerMarius Zbihlei <marius.zbihlei@1and1.ro>
Fri, 5 Feb 2010 09:23:08 +0000 (11:23 +0200)
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
Makefile.rules

index b6dc645..272cff3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -603,17 +603,7 @@ $(1)_target=$(prefix)/$(modules_dir)$(1)
 
 .PHONY: $(1)
 $(1): modules.lst
 
 .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
 
 .PHONY: $(1)-doc
 $(1)-doc: modules.lst
index e2ba439..7b46ef3 100644 (file)
@@ -76,6 +76,16 @@ quiet=verbose
 oecho=echo $(1)
 endif
 
 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)),\
 quote:= "
 escall= $(subst $$,\$$,$(subst $(quote),\$(quote),$1))
 exec_cmd= $(if $($(quiet)_cmd_$(1)),\