]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/base
Fixed problem with parallel make (-j) caused by the previous change
[omk.git] / snippets / base
index bc9622be6bd2419b8618c57da4095b8954428196..6e352d0be9b38d1b3dbfe5a59a1d567df54df816 100644 (file)
@@ -179,12 +179,14 @@ endif
 # Usage: $(call omk_pass_subdir_template,<pass name>,<build dir>,<subdir>)
 define omk_pass_subdir_template
 .PHONY: $(1)-$(3)-subdir
-$(1): $(1)-$(3)-subdir
+$(1)-submakes: $(1)-$(3)-subdir
 $(1)-$(3)-subdir:
        @$(call mkdir_def,$(2)/$(3))
        +@$(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(3) $(NO_PRINT_DIRECTORY) \
                RELATIVE_DIR=$(RELATIVE_PREFIX)$(3) -C $(2)/$(3) \
-               -f $(SUBDIR_MAKEFILE) $(1)
+               -f $(SUBDIR_MAKEFILE) $(1)-submakes
+# In subdirectories we can call submakes directly since passes are
+# already searialized on the toplevel make.
 endef
 
 ifdef OMK_TESTSROOT
@@ -193,12 +195,19 @@ endif
 
 # Usage: $(call omk_pass_template,<pass name>,<build dir>,[<local make flags>],[<local enable condition>])
 define omk_pass_template
-.PHONY: $(1) $(addsuffix -local,$(1)) $(addsuffix -check,$(1))
+.PHONY: $(1) $(1)-local $(1)-check $(1)-submakes
 $(foreach subdir,$(SUBDIRS),$(eval $(call omk_pass_subdir_template,$(1),$(2),$(subdir))))
 $(1):
+# Submakes have to be called this way and not as dependecies for pass
+# serialization to work
+       +@$(MAKE) SOURCES_DIR=$(SOURCES_DIR) --no-print-directory \
+               RELATIVE_DIR=$(RELATIVE_DIR) \
+               -f $(SOURCESDIR_MAKEFILE) $(1)-submakes
+$(1)-submakes:
        @true                   # Do not emit "nothing to be done" messages
+
 ifneq ($(4),)
-$(1): $(1)-this-dir
+$(1)-submakes: $(1)-this-dir
 $(1)-this-dir: $(foreach subdir,$(SUBDIRS),$(1)-$(subdir)-subdir)
        +@echo "make[omk]: $(strip $(1)) in $(RELATIVE_DIR)"
        @$(call mkdir_def,$(2))