[Libreoffice-commits] .: Branch 'libreoffice-3-5' - solenv/gbuild

Michael Stahl mst at kemper.freedesktop.org
Mon Dec 19 03:21:55 PST 2011


 solenv/gbuild/ComponentTarget.mk |    3 ++-
 solenv/gbuild/CppunitTest.mk     |    4 ++--
 solenv/gbuild/Library.mk         |   16 ++++++++++++----
 solenv/gbuild/TargetLocations.mk |    2 ++
 4 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 176e98241a09d5ccf3da59e61931cee9baa333bb
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 16 19:58:33 2011 +0100

    gbuild: refactor gb_Library_set_componentfile:
    
    Reverse the dependency: now the component target depends (order-only) on the
    library, which should ensure that gb_CppunitTest_add_component can set up
    dependencies such that the unit test does not run concurrently with
    a library loaded via UNO being overwritten.
    
    Unfortunately this requires introducing another phony dummy library
    target, on which the module can depend (because we don't want to register
    the component target as a module target).
    (cherry picked from commit 0ef8beedb1d2ce70e4d5ec7b24afd1711db29f38)
    
    Conflicts:
    
    	solenv/gbuild/Library.mk

diff --git a/solenv/gbuild/ComponentTarget.mk b/solenv/gbuild/ComponentTarget.mk
index 031d118..efe4819 100644
--- a/solenv/gbuild/ComponentTarget.mk
+++ b/solenv/gbuild/ComponentTarget.mk
@@ -58,7 +58,8 @@ $(call gb_ComponentTarget_get_outdir_target,%) :
 define gb_ComponentTarget_ComponentTarget
 $(call gb_ComponentTarget_get_target,$(1)) : COMPONENTPREFIX := $(2)
 $(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(3)
-$(call gb_ComponentTarget_get_outdir_target,$(1)) : $(call gb_ComponentTarget_get_target,$(1))
+$(call gb_ComponentTarget_get_outdir_target,$(1)) : \
+	$(call gb_ComponentTarget_get_target,$(1))
 $(call gb_Deliver_add_deliverable,$(call gb_ComponentTarget_get_outdir_target,$(1)),$(call gb_ComponentTarget_get_target,$(1)),$(1))
 
 endef
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index aa87be6..0d8959e 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -153,9 +153,9 @@ endef
 
 define gb_CppunitTest_add_component
 $(call gb_CppunitTest_get_target,$(1)) : \
-    $(call gb_ComponentTarget_get_target,$(2))
+    $(call gb_ComponentTarget_get_outdir_target,$(2))
 $(call gb_CppunitTest_get_target,$(1)) : \
-    UNO_SERVICES += $(call gb_ComponentTarget_get_target,$(2))
+    UNO_SERVICES += $(call gb_ComponentTarget_get_outdir_target,$(2))
 
 endef
 
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 82daae1..631a553 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -39,6 +39,8 @@
 #  gb_Library_Library_platform
 #  gb_Library_TARGETS
 
+# doesn't do anything, just used for hooking up component target
+.PHONY: $(call gb_Library__get_final_target,%)
 
 # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
 .PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT)
@@ -69,21 +71,27 @@ $(call gb_LinkTarget_set_targettype,$(2),Library)
 $(call gb_LinkTarget_add_defs,$(2),\
 	$(gb_Library_DEFS) \
 )
+$(call gb_Library__get_final_target,$(1)) : $(call gb_Library_get_target,$(1))
 $(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
 $(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
 $(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1)))
-$$(eval $$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1))))
+$$(eval $$(call gb_Module_register_target,$(call gb_Library__get_final_target,$(1)),$(call gb_Library_get_clean_target,$(1))))
 $(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1))
 
 endef
 
+# The dependency from workdir component target to outdir library should ensure
+# that gb_CppunitTest_add_component can transitively depend on the library.
+# But the component target also must be delivered, so a new phony target
+# gb_Library__get_final_target has been invented for that purpose...
 define gb_Library_set_componentfile
 $(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),\
 	$(call gb_Library_get_runtime_filename,$(if $(MERGELIBS),$(if $(filter $(gb_MERGED_LIBS),$(1)),merged,$(1)),$(1))))
-$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktargetname,$(1))) : \
+$(call gb_Library__get_final_target,$(1)) : \
 	$(call gb_ComponentTarget_get_outdir_target,$(2))
-$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(or $(strip $(3)),$(strip $(2))))
-
+$(call gb_ComponentTarget_get_target,$(2)) :| $(call gb_Library_get_target,$(1))
+$(call gb_Library_get_clean_target,$(1)) : \
+	$(call gb_ComponentTarget_get_clean_target,$(2))
 endef
 
 gb_Library__get_componentprefix = \
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index b7a4fde..cbe2ee7 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -133,6 +133,8 @@ gb_XcuResTarget_get_target = $(WORKDIR)/XcuResTarget/$(1)
 gb_Zip_get_target = $(WORKDIR)/Zip/$(1).zip
 gb_Zip_get_final_target = $(WORKDIR)/Zip/$(1).done
 
+gb_Library__get_final_target = $(WORKDIR)/Dummy/$(1)
+
 define gb_Library_get_external_headers_target
 $(patsubst $(1):%,$(WORKDIR)/ExternalHeaders/Library/%,$(filter $(1):%,$(gb_Library_FILENAMES)))
 endef


More information about the Libreoffice-commits mailing list