Branch: Tag:

2019-05-04

2019-05-04 10:50:49 by Marcus Comstedt <marcus@mc.pp.se>

Build: Fix parallel make

Since module_objects are built in sub-makes, also build
post_modules_objects and pike-complete-stamp in a submake to ensure
correct ordering and that dependencies do not get built while a
submake is also building them at the same time.

There is no need to tell the submake explicitly to build
post_module_objects, since pike-complete-stamp depends on
post-modules-stamp.

Also, join foo_module_objects and foo-modules-stamp into the same rule
since they have the same prerequisites and the same action so thay are
the same anyway (but could accidentally be built in parallel if they
are separate rules).

231:   #      # Update the dumped modules, but only if dump_modules has been used earlier. - all: module_objects post_module_objects pike-complete-stamp + all: module_objects +  @$(MAKE) $(MAKE_FLAGS) pike-complete-stamp    @if [ -f dumpversion ]; then \    echo "$(MAKE) $(MAKE_FLAGS) dump_modules"; \    $(MAKE) $(MAKE_FLAGS) dump_modules; \
1141:      # touch static-modules-stamp here to avoid doing this work again if   # that target is checked later. - static_module_objects: $(MODULE_REQUIREMENTS) + static_module_objects static-modules-stamp: $(MODULE_REQUIREMENTS)    @MODULE_BUILD_TYPE=static; \    export MODULE_BUILD_TYPE; \    ( cd modules && ( rm remake >/dev/null 2>&1 || : ) && \
1150:    ) || exit $$?    @touch static-modules-stamp    - static-modules-stamp: $(MODULE_REQUIREMENTS) -  @MODULE_BUILD_TYPE=static; \ -  export MODULE_BUILD_TYPE; \ -  ( cd modules && ( rm remake >/dev/null 2>&1 || : ) && \ -  ( $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) || \ -  ( test -f remake && $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) ) ) \ -  ) || exit $$? -  @touch static-modules-stamp -  - dynamic_module_objects: $(MODULE_REQUIREMENTS) @LDSHARED_BASE_REQS@ + dynamic_module_objects dynamic-modules-stamp: $(MODULE_REQUIREMENTS) @LDSHARED_BASE_REQS@    @MODULE_BUILD_TYPE=dynamic; \    export MODULE_BUILD_TYPE; \    ( cd modules && ( rm remake >/dev/null 2>&1 || : ) && \
1168:    ) || exit $$?    @touch dynamic-modules-stamp    - dynamic-modules-stamp: $(MODULE_REQUIREMENTS) @LDSHARED_BASE_REQS@ -  @MODULE_BUILD_TYPE=dynamic; \ -  export MODULE_BUILD_TYPE; \ -  ( cd modules && ( rm remake >/dev/null 2>&1 || : ) && \ -  ( $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) || \ -  ( test -f remake && $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) ) ) \ -  ) || exit $$? -  @touch dynamic-modules-stamp -  +    # Use submakes here to ensure both correct sequencing and that all   # modules are properly rechecked.   module_objects:
1199:   # Backward compat.   post_modules: post_module_objects    - post_module_objects: pike@EXEEXT@ $(MODULE_REQUIREMENTS) post-module-pike-stamp @LDSHARED_BASE_REQS@ + post_module_objects post-modules-stamp: pike@EXEEXT@ $(MODULE_REQUIREMENTS) post-module-pike-stamp @LDSHARED_BASE_REQS@    @MODULE_BUILD_TYPE=@POST_MODULE_BUILD_TYPE@; \    export MODULE_BUILD_TYPE; \    ( cd post_modules && ( rm remake >/dev/null 2>&1 || : ) && \
1208:    ) || exit $$?    @touch post-modules-stamp    - post-modules-stamp: pike@EXEEXT@ $(MODULE_REQUIREMENTS) post-module-pike-stamp @LDSHARED_BASE_REQS@ -  @MODULE_BUILD_TYPE=@POST_MODULE_BUILD_TYPE@; \ -  export MODULE_BUILD_TYPE; \ -  ( cd post_modules && ( rm remake >/dev/null 2>&1 || : ) && \ -  ( $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) || \ -  ( test -f remake && $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) ) ) \ -  ) || exit $$? -  @touch post-modules-stamp -  +    post_modules/modlist_headers.h: post-modules-stamp      post_modules/modlist.h: post-modules-stamp