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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu May 23 09:02:01 UTC 2019


 solenv/gbuild/PrecompiledHeaders.mk     |    2 +-
 solenv/gbuild/platform/com_GCC_class.mk |   26 ++++++++++++++++++++++++++
 solenv/gbuild/platform/com_MSC_class.mk |    4 ++++
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit be6227b6c8d6ffacb7168e76856c7e059c08bf77
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sat May 18 19:21:11 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu May 23 11:00:59 2019 +0200

    try to get a good checksum for CCACHE_PCH_EXTSUM also with gcc
    
    Its PCHs are always different even if the source is the same (timestamps
    somewhere?). But if the output of gcc -E for that precompiled header
    source is the same, then technically the .gch should be without a change.
    So this makes ccache get hits even if the .gch gets rebuilt, as long
    as ccache is new enough to support CCACHE_PCH_EXTSUM (3.5+).
    
    Change-Id: I447bb4840047f23deed55e25de1794047a0a9998
    Reviewed-on: https://gerrit.libreoffice.org/72705
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/solenv/gbuild/PrecompiledHeaders.mk b/solenv/gbuild/PrecompiledHeaders.mk
index e7df26abd77a..9bf64e2e4cbb 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -42,7 +42,7 @@ $(call gb_PrecompiledHeader_get_dep_target,$(1),$(2)) :
 $(call gb_PrecompiledHeader_get_target,$(1),$(2)) :
 	rm -f $$@
 	$$(call gb_PrecompiledHeader__command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(2))
-	$(SHA256SUM) $$@ >$$@.sum
+	$$(call gb_PrecompiledHeader__sum_command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(2))
 ifeq ($(gb_FULLDEPS),$(true))
 	$$(call gb_Helper_abbreviate_dirs,\
 		RESPONSEFILE=$$(call var2file,$$(shell $$(gb_MKTEMP)),200,$$(call gb_PrecompiledHeader_get_dep_target_tmp,$(1),$(2))) && \
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index b9f9e3ea62aa..73c9b1cc4175 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -110,6 +110,32 @@ $(call gb_Helper_abbreviate_dirs,\
 		)
 endef
 
+ifeq ($(COM_IS_CLANG),TRUE)
+# Clang has -fno-pch-timestamp, just checksum the file for CCACHE_PCH_EXTSUM
+define gb_PrecompiledHeader__sum_command
+	$(SHA256SUM) $(1) >$(1).sum
+endef
+else
+# GCC does not generate the same .gch for the same input, so checksum the (preprocessed) input
+define gb_PrecompiledHeader__sum_command
+$(call gb_Helper_abbreviate_dirs,\
+	CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
+	$(gb_CXX) \
+		-x c++-header \
+		$(4) $(5) \
+		$(gb_COMPILERDEPFLAGS) \
+		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+		$(gb_NO_PCH_TIMESTAMP) \
+		$(6) \
+		-E $(patsubst %.cxx,%.hxx,$(3)) \
+		-o- \
+		| $(SHA256SUM) >$(1).sum \
+		)
+endef
+endif
+
+
 # YaccTarget class
 
 define gb_YaccTarget__command
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 5a02ea57eeac..705e50a7a563 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -91,6 +91,10 @@ $(call gb_Helper_abbreviate_dirs,\
 		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(7)),$(1),$(3))
 endef
 
+# No ccache with MSVC, no need to create a checksum for it.
+define gb_PrecompiledHeader__sum_command
+endef
+
 # AsmObject class
 
 gb_AsmObject_get_source = $(1)/$(2).asm


More information about the Libreoffice-commits mailing list