Removed the @for construct (launched a new shell) with a @foreach construct which does a textual expansion of the block in question (loop unrolling)
@@ -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, "" ;) \
- if $(MAKE) -C $$$$r $$(mk_params) || [ ${err_fail} != 1 ] ; then \
- :; \
- else \
- exit 1; \
- fi ; \
- done; true
+ @$(foreach r,$($(1)),$(call module_make,$(r),$(mk_params)))
.PHONY: $(1)-doc
$(1)-doc: modules.lst
@@ -76,6 +76,16 @@ quiet=verbose
oecho=echo $(1)
endif
+module_make= if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \
+ $(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)),\