diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-05-18 19:21:11 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-05-23 11:00:59 +0200 |
commit | be6227b6c8d6ffacb7168e76856c7e059c08bf77 (patch) | |
tree | 1ca0c38390968b79d7ae9b8b8a2667451ec3cdc0 /solenv/gbuild/platform/com_GCC_class.mk | |
parent | 065299f78cda005e3329c9695b1a949051e580d6 (diff) |
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@collabora.com>
Diffstat (limited to 'solenv/gbuild/platform/com_GCC_class.mk')
-rw-r--r-- | solenv/gbuild/platform/com_GCC_class.mk | 26 |
1 files changed, 26 insertions, 0 deletions
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 |