summaryrefslogtreecommitdiff
path: root/solenv/gbuild/LinkTarget.mk
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-04-08 10:59:59 +0200
committerMichael Stahl <mstahl@redhat.com>2013-04-15 15:26:30 +0200
commit3213cd54b76bc80a6f0516aac75a48ff3b2ad67c (patch)
tree4bf0e87d20ad4218086cf6373ba2a2d9045c32aa /solenv/gbuild/LinkTarget.mk
parenteacf12eeb174e35a301570726bf74434a4dd4b94 (diff)
gbuild: LinkTarget: only re-link libraries if exported symbols change
Write out the exported symbols of a Library to a "libfoo.so.exports" file, which is only touched when linking if the exported symbols actually change, and let dependent LinkTargets depend on this exports file instead of the library itself, for faster rebuilds. This is currently supposed to work on ELF and MacOSX platforms. Thanks to Ami Fischman of Chromium for the idea. Change-Id: Ie4b5da0853140709e517028b514800b044527e61
Diffstat (limited to 'solenv/gbuild/LinkTarget.mk')
-rw-r--r--solenv/gbuild/LinkTarget.mk14
1 files changed, 13 insertions, 1 deletions
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 98964d764ff5..f5c16f3722c5 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -402,6 +402,7 @@ $(call gb_LinkTarget_get_clean_target,%) :
$(call gb_LinkTarget_get_headers_target,$*) \
$(call gb_LinkTarget_get_external_headers_target,$*) \
$(call gb_LinkTarget_get_objects_list,$*) \
+ $(call gb_LinkTarget_get_target,$*).exports \
$(DLLTARGET) \
$(AUXTARGETS)) && \
cat $${RESPONSEFILE} /dev/null | xargs -n 200 rm -fr && \
@@ -442,6 +443,14 @@ mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2))
endef
+# Target for the .exports of the shared library, to speed up incremental build.
+# This deliberately does nothing if the file exists; the file is actually
+# written in gb_LinkTarget__command_dynamiclink.
+# Put this pattern rule here so it overrides the one below.
+# (this is rather ugly: because of % the functions cannot be used)
+$(call gb_LinkTarget_get_target,Library/%.exports) : $(gb_Library_OUTDIRLOCATION)/%
+ $(if $(wildcard $@),true,touch $@)
+
$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
$(call gb_LinkTarget__command,$@,$*)
$(call gb_LinkTarget__command_objectlist,$@,$*)
@@ -830,7 +839,10 @@ endif
$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3)
-$(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(3),$(call gb_Library_get_target,$(lib)))
+# depend on the exports of the library, not on the library itself
+# for faster incremental builds when the ABI is unchanged
+$(call gb_LinkTarget_get_target,$(1)) : \
+ $(foreach lib,$(3),$(call gb_Library_get_exports_target,$(lib)))
$(call gb_LinkTarget_get_external_headers_target,$(1)) : \
$(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))