[Libreoffice-commits] core.git: solenv/gbuild

Michael Stahl mstahl at redhat.com
Tue Jul 16 06:14:12 PDT 2013


 solenv/gbuild/AllLangResTarget.mk |   14 ++++++++++++--
 solenv/gbuild/LinkTarget.mk       |   24 +++++++++++++++---------
 solenv/gbuild/UnoApiTarget.mk     |   16 ++++++++++++----
 3 files changed, 39 insertions(+), 15 deletions(-)

New commits:
commit 4780d94d6d52ff68c72a81bf3e00dbe850995c8c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Jul 14 22:29:39 2013 +0200

    gbuild: update included dep-targets as side effect of targets
    
    Make builds in 2 phases: first it ensures that all targets that are
    included by the makefiles (i.e. the .d files) are up to date, then
    it restarts and builds everything else.
    
    It would be possible to update the .d files in the same build by simply
    having dependencies from the dep-targets to the corresponding real targets,
    but that has undesirable effects (8b5a984d45005d3df1c89eae897d6e04612625d8).
    
    For a successful build, the .d files can actually be updated as a side
    effect of other rules in such a way that they will be up-to-date on the
    next make invocation, thus the restart can be avoided.
    This optimization will not always work in case of build failures.
    
    Change-Id: I753039ed33f5a84104f35990769eddc83e1d0d7e

diff --git a/solenv/gbuild/AllLangResTarget.mk b/solenv/gbuild/AllLangResTarget.mk
index 3ad5065..55a8d57 100644
--- a/solenv/gbuild/AllLangResTarget.mk
+++ b/solenv/gbuild/AllLangResTarget.mk
@@ -227,7 +227,8 @@ define gb_SrsTarget__command_dep
 $(call gb_Output_announce,SRS:$(2),$(true),DEP,1)
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) && \
-	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,$(3)) && \
+	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
+		$(foreach part,$(PARTS),$(call gb_SrsPartTarget_get_dep_target,$(part)))) && \
 	$(call gb_Executable_get_command,concat-deps) $${RESPONSEFILE} > $(1)) && \
 	rm -f $${RESPONSEFILE}
 endef
@@ -237,7 +238,12 @@ $(call gb_SrsTarget_get_headers_target,%) :
 	$(call gb_Helper_abbreviate_dirs,\
 	    mkdir -p $(dir $@) && touch $@)
 
+# This recipe actually also builds the dep-target as a side-effect, which
+# is an optimization to reduce incremental build time.
 $(call gb_SrsTarget_get_target,%) :
+ifeq ($(gb_FULLDEPS),$(true))
+	$(call gb_SrsTarget__command_dep,$(call gb_SrsTarget_get_dep_target,$*),$*)
+endif
 	$(call gb_Output_announce,$*,$(true),SRS,1)
 	$(call gb_Helper_abbreviate_dirs,\
 		mkdir -p $(dir $@) && \
@@ -246,7 +252,7 @@ $(call gb_SrsTarget_get_target,%) :
 ifeq ($(gb_FULLDEPS),$(true))
 $(call gb_SrsTarget_get_dep_target,%) : \
 		$(call gb_Executable_get_runtime_dependencies,concat-deps)
-	$(call gb_SrsTarget__command_dep,$@,$*,$^)
+	$(call gb_SrsTarget__command_dep,$@,$*)
 endif
 
 define gb_SrsTarget_SrsTarget
@@ -258,6 +264,7 @@ $(call gb_SrsTarget_get_target,$(1)) : PARTS :=
 $(call gb_SrsTarget_get_target,$(1)) : $(call gb_SrsTemplateTarget_get_target,$(1))
 $(call gb_SrsTarget_get_clean_target,$(1)) : $(call gb_SrsTemplateTarget_get_clean_target,$(1))
 ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_SrsTarget_get_dep_target,$(1)) : PARTS :=
 -include $(call gb_SrsTarget_get_dep_target,$(1))
 endif
 
@@ -289,6 +296,9 @@ $(call gb_SrsPartTarget_get_target,$(2)) :| $(call gb_SrsTarget_get_headers_targ
 $(call gb_SrsPartTarget_get_target,$(2)) :| $(call gb_SrsTemplateTarget_get_target,$(1))
 $(call gb_SrsTarget_get_clean_target,$(1)) : PARTS += $(2)
 $(call gb_SrsTarget_get_target,$(1)) : PARTS += $(2)
+ifeq ($(gb_FULLDEPS),$(true))
+$(call gb_SrsTarget_get_dep_target,$(1)) : PARTS += $(2)
+endif
 
 endef
 
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index a5c7132..3b64806 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -395,13 +395,13 @@ $(call gb_Output_announce,LNK:$(2),$(true),DEP,1)
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) && \
 	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
-		$(foreach object,$(3),$(call gb_CObject_get_dep_target,$(object))) \
-		$(foreach object,$(4),$(call gb_CxxObject_get_dep_target,$(object))) \
-		$(foreach object,$(5),$(call gb_ObjCObject_get_dep_target,$(object)))\
-		$(foreach object,$(6),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
-		$(foreach object,$(7),$(call gb_AsmObject_get_dep_target,$(object)))\
-		$(foreach object,$(8),$(call gb_GenCObject_get_dep_target,$(object))) \
-		$(foreach object,$(9),$(call gb_GenCxxObject_get_dep_target,$(object))) \
+		$(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
+		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
+		$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object)))\
+		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
+		$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object)))\
+		$(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \
+		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
 		) && \
 	$(call gb_Executable_get_command,concat-deps) $${RESPONSEFILE} > $(1)) && \
 	rm -f $${RESPONSEFILE}
@@ -431,7 +431,14 @@ endef
 $(call gb_LinkTarget_get_target,Library/%.exports) : $(gb_Library_OUTDIRLOCATION)/%
 	$(if $(wildcard $@),,mkdir -p $(dir $@) && touch $@)
 
+# This recipe actually also builds the dep-target as a side-effect, which
+# is an optimization to reduce incremental build time.
+# (with exception for concat-dep executable itself which does not exist yet...)
 $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
+ifeq ($(gb_FULLDEPS),$(true))
+	$(if $(findstring concat-deps,$*),,\
+		$(call gb_LinkTarget__command_dep,$(call gb_LinkTarget_get_dep_target,$*),$*))
+endif
 	$(if $(filter $*,$(foreach lib,$(gb_MERGEDLIBS) $(gb_URELIBS),$(call gb_Library_get_linktargetname,$(lib)))),\
 		$(if $(filter $(true),$(call gb_LinkTarget__is_build_lib,$*)),\
 			$(call gb_LinkTarget__command,$@,$*),\
@@ -442,8 +449,7 @@ $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%)
 
 ifeq ($(gb_FULLDEPS),$(true))
 $(call gb_LinkTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps)
-
-	$(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCOBJECTS),$(OBJCXXOBJECTS),$(ASMOBJECTS),$(GENCOBJECTS),$(GENCXXOBJECTS))
+	$(call gb_LinkTarget__command_dep,$@,$*)
 endif
 
 # Ok, this is some dark voodoo: When declaring a linktarget with
diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index 59a2fc2..368c28e 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -114,7 +114,13 @@ $(if $(UNOAPI_FILES),,$(error No IDL files have been set for the rdb file))
 $(if $(UNOAPI_ROOT),,$(error No root has been set for the rdb file))
 endef
 
+# This recipe actually also builds the dep-target as a side-effect, which
+# is an optimization to reduce incremental build time.
+# Note this requires the variable UNOAPI_DEPFILES to be in sync on both targets.
 $(call gb_UnoApiTarget_get_target,%) :
+ifeq ($(gb_FULLDEPS),$(true))
+	$(call gb_UnoApiTarget__command_dep,$(call gb_UnoApiTarget_get_dep_target,$*),$*)
+endif
 	$(call gb_UnoApiTarget__check_mode)
 	$(call gb_UnoApiTarget__command,$@,$*)
 
@@ -134,7 +140,7 @@ $(call gb_Output_announce,IDL:$(2),$(true),DEP,1)
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) && \
 	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
-		$(foreach idl,$(patsubst %.idl,%,$(3)),$(call gb_UnoApiPartTarget_get_dep_target,$(idl)))) && \
+		$(foreach idl,$(UNOAPI_DEPFILES),$(call gb_UnoApiPartTarget_get_dep_target,$(idl)))) && \
 	$(call gb_Executable_get_command,concat-deps) $${RESPONSEFILE} > $(1)) && \
 	rm -f $${RESPONSEFILE}
 
@@ -148,7 +154,7 @@ $(dir $(call gb_UnoApiTarget_get_dep_target,%))%/.dir :
 	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
 
 $(call gb_UnoApiTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps)
-	$(call gb_UnoApiTarget__command_dep,$@,$*,$(UNOAPI_IDLFILES))
+	$(call gb_UnoApiTarget__command_dep,$@,$*)
 
 endif
 
@@ -160,7 +166,8 @@ $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_ROOT :=
 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_DEPRDBS :=
 
 ifeq ($(gb_FULLDEPS),$(true))
-$(call gb_UnoApiTarget_get_dep_target,$(1)) : UNOAPI_IDLFILES :=
+$(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_DEPFILES :=
+$(call gb_UnoApiTarget_get_dep_target,$(1)) : UNOAPI_DEPFILES :=
 -include $(call gb_UnoApiTarget_get_dep_target,$(1))
 $(call gb_UnoApiTarget_get_dep_target,$(1)) :| $(dir $(call gb_UnoApiTarget_get_dep_target,$(1))).dir
 endif
@@ -182,7 +189,8 @@ $(call gb_UnoApiPartTarget_get_target,$(2)/$(3).urd) \
 	| $(call gb_UnoApiPartTarget_get_target,$(2)/.dir)
 
 ifeq ($(gb_FULLDEPS),$(true))
-$(call gb_UnoApiTarget_get_dep_target,$(1)) : UNOAPI_IDLFILES += $(2)/$(3).idl
+$(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_DEPFILES += $(2)/$(3)
+$(call gb_UnoApiTarget_get_dep_target,$(1)) : UNOAPI_DEPFILES += $(2)/$(3)
 $(call gb_UnoApiTarget_get_dep_target,$(1)) : \
 	$(call gb_UnoApiPartTarget_get_dep_target,$(2)/$(3))
 $(call gb_UnoApiPartTarget_get_dep_target,$(2)/$(3)) :| $(dir $(call gb_UnoApiPartTarget_get_dep_target,$(2)/$(3))).dir


More information about the Libreoffice-commits mailing list