do not rebuild PCHs on icecream/ccache change
We turn -Wunused-macros on or off depending on whether icecream/ccache are used, and since now PCHs rebuild on CXXFLAGS changes, a plain temporary 'CCACHE_DISABLE=1' caused a rebuild. Change-Id: I63d539ac037d595f76a39e585011d1fde54f7f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125125 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
parent
7dc558c298
commit
359b53acdb
5 changed files with 34 additions and 19 deletions
|
@ -1915,7 +1915,7 @@ $(call gb_LinkTarget_get_pch_reuse_timestamp,$(4)) : $(call gb_PrecompiledHeader
|
|||
$(call gb_PrecompiledHeader_check_flags,$(4),$(2),\
|
||||
$(call gb_PrecompiledHeader_get_target,$(3),$(4)),\
|
||||
$(call gb_PrecompiledHeader_get_flags_file,$(3),$(4)),\
|
||||
$$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS))
|
||||
$(gb_PrecompiledHeader_cxxflags_includes))
|
||||
$$(call gb_PrecompiledHeader__copy_reuse_files,$(1),$(3),$(4))
|
||||
mkdir -p $$(dir $$@) && touch $$@
|
||||
|
||||
|
|
|
@ -36,6 +36,12 @@ ifneq ($(gb_ENABLE_PCH),)
|
|||
# for $(1)'s and things that are constant.
|
||||
# The defines are needed to get the right version of gb_PrecompiledHeader__get_debugdir.
|
||||
|
||||
# all cxxflags to use for compilation
|
||||
gb_PrecompiledHeader_cxxflags_includes := $$(PCH_DEFS) $$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS)
|
||||
# flags to save to the .flags file to check if they are the same as last time
|
||||
gb_PrecompiledHeader_flags_for_flags_file := $$(sort $(gb_PrecompiledHeader_cxxflags_includes)) \
|
||||
$(if $(gb_PrecompiledHeader_ignore_flags_for_flags_file),| sed 's/$(gb_PrecompiledHeader_ignore_flags_for_flags_file)//')
|
||||
|
||||
# $(call gb_PrecompiledHeader_generate_rules,pchtarget,linktarget,linktargetmakefilename,pchcxxfile,compiler)
|
||||
define gb_PrecompiledHeader_generate_rules
|
||||
|
||||
|
@ -48,8 +54,8 @@ $(call gb_PrecompiledHeader_get_dep_target,$(1),$(3)) :
|
|||
# change, and make the PCH depend on it => the PCH will be rebuilt on any flags change
|
||||
.PHONY: force
|
||||
$(call gb_PrecompiledHeader_get_flags_file,$(1),$(3)) : force
|
||||
echo $$(sort $$(PCH_DEFS) $$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS)) | cmp -s - $$@ \
|
||||
|| echo $$(sort $$(PCH_DEFS) $$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS)) > $$@
|
||||
echo $(gb_PrecompiledHeader_flags_for_flags_file) | cmp -s - $$@ \
|
||||
|| echo $(gb_PrecompiledHeader_flags_for_flags_file) > $$@
|
||||
|
||||
# despite this being only one .d file, need to run concat-deps on it to
|
||||
# re-write external headers from UnpackedTarball
|
||||
|
@ -57,8 +63,8 @@ $(call gb_PrecompiledHeader_get_target,$(1),$(3)) :
|
|||
test "$$(PCH_LINKTARGETMAKEFILENAME)" = "$(3)" \
|
||||
|| ( echo "Error, PCH $(1) built by $$(PCH_LINKTARGETMAKEFILENAME) instead of $(3)" >&2; exit 1)
|
||||
rm -f $$@
|
||||
$$(call gb_PrecompiledHeader__command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3),$(5))
|
||||
$$(call gb_PrecompiledHeader__sum_command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3))
|
||||
$$(call gb_PrecompiledHeader__command,$$@,$(1),$$<,$(gb_PrecompiledHeader_cxxflags_includes),$$(INCLUDE),$(3),$(5))
|
||||
$$(call gb_PrecompiledHeader__sum_command,$$@,$(1),$$<,$(gb_PrecompiledHeader_cxxflags_includes),$$(INCLUDE),$(3))
|
||||
ifeq ($(gb_FULLDEPS),$(true))
|
||||
$$(call gb_Helper_abbreviate_dirs,\
|
||||
RESPONSEFILE=$$(call gb_var2file,$$(shell $$(gb_MKTEMP)),200,$$(call gb_PrecompiledHeader_get_dep_target_tmp,$(1),$(3))) && \
|
||||
|
|
|
@ -129,51 +129,53 @@ endif
|
|||
# This is for MSVC's object file built directly as a side-effect of building the PCH.
|
||||
gb_PrecompiledHeader_get_objectfile =
|
||||
|
||||
# $(call gb_PrecompiledHeader__command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler)
|
||||
define gb_PrecompiledHeader__command
|
||||
$(call gb_Output_announce,$(2),$(true),PCH,1)
|
||||
$(call gb_Trace_StartRange,$(2),PCH)
|
||||
$(call gb_Helper_abbreviate_dirs,\
|
||||
mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(7))) && \
|
||||
mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(6))) && \
|
||||
cd $(BUILDDIR)/ && \
|
||||
CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
|
||||
$(if $(8),$(8),$(gb_CXX)) \
|
||||
$(if $(7),$(7),$(gb_CXX)) \
|
||||
-x c++-header $(gb_PrecompiledHeader_emit_pch) \
|
||||
$(4) \
|
||||
$(if $(7), $(call gb_CObject__filter_out_clang_cflags,$(5)),$(5)) \
|
||||
$(if $(7), $(call gb_CObject__filter_out_clang_cflags,$(4)),$(4)) \
|
||||
$(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \
|
||||
$(gb_COMPILERDEPFLAGS) \
|
||||
$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
|
||||
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
|
||||
$(gb_NO_PCH_TIMESTAMP) \
|
||||
$(gb_PrecompiledHeader_extra_pch_cxxflags) \
|
||||
$(6) \
|
||||
$(call gb_cxx_dep_generation_options,$(1),$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(7))) \
|
||||
$(5) \
|
||||
$(call gb_cxx_dep_generation_options,$(1),$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(6))) \
|
||||
-c $(patsubst %.cxx,%.hxx,$(3)) \
|
||||
-o$(1) \
|
||||
$(call gb_cxx_dep_copy,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(7))) \
|
||||
$(call gb_cxx_dep_copy,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(6))) \
|
||||
)
|
||||
$(call gb_Trace_EndRange,$(2),PCH)
|
||||
endef
|
||||
|
||||
ifeq ($(COM_IS_CLANG),TRUE)
|
||||
# Clang has -fno-pch-timestamp, just checksum the file for CCACHE_PCH_EXTSUM
|
||||
# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename)
|
||||
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
|
||||
# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename)
|
||||
define gb_PrecompiledHeader__sum_command
|
||||
$(call gb_Helper_abbreviate_dirs,\
|
||||
CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
|
||||
$(gb_CXX) \
|
||||
-x c++-header \
|
||||
$(4) $(5) \
|
||||
$(4) \
|
||||
$(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \
|
||||
$(gb_COMPILERDEPFLAGS) \
|
||||
$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
|
||||
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
|
||||
$(gb_NO_PCH_TIMESTAMP) \
|
||||
$(6) \
|
||||
$(5) \
|
||||
-E $(patsubst %.cxx,%.hxx,$(3)) \
|
||||
-o- \
|
||||
| $(SHA256SUM) >$(1).sum \
|
||||
|
|
|
@ -215,6 +215,11 @@ endif
|
|||
|
||||
gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
|
||||
|
||||
# We turn on and off this one depending on whether icecream and/or ccache are used,
|
||||
# and changing cxxflags cause PCH rebuilds, so e.g. a plain temporary 'CCACHE_DISABLE=1'
|
||||
# would cause a rebuild. Ignore the flag there, it's irrelevant for PCH use anyway.
|
||||
gb_PrecompiledHeader_ignore_flags_for_flags_file := $(gb_SPACE)-Wunused-macros
|
||||
|
||||
# optimization level
|
||||
gb_COMPILERNOOPTFLAGS := -O0 -fstrict-aliasing -fstrict-overflow
|
||||
gb_COMPILERDEBUGOPTFLAGS := -Og
|
||||
|
|
|
@ -100,26 +100,28 @@ gb_PrecompiledHeader_EXT := .pch
|
|||
# MSVC PCH needs extra .obj created during the creation of the PCH file
|
||||
gb_PrecompiledHeader_get_objectfile = $(1).obj
|
||||
|
||||
# $(call gb_PrecompiledHeader__command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler)
|
||||
define gb_PrecompiledHeader__command
|
||||
$(call gb_Output_announce,$(2),$(true),PCH,1)
|
||||
$(call gb_Trace_StartRange,$(2),PCH)
|
||||
$(call gb_Helper_abbreviate_dirs,\
|
||||
mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(7))) && \
|
||||
mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(6))) && \
|
||||
unset INCLUDE && \
|
||||
$(call gb_CObject__compiler,$(4) $(5),$(3),$(8)) \
|
||||
$(call gb_CObject__compiler,$(4),$(3),$(7)) \
|
||||
$(call gb_Helper_remove_overridden_flags, \
|
||||
$(4) $(5) $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \
|
||||
$(4) $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \
|
||||
-Fd$(PDBFILE) \
|
||||
$(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \
|
||||
$(if $(filter YES,$(LIBRARY_X64)), ,$(gb_LTOFLAGS)) \
|
||||
$(gb_COMPILERDEPFLAGS) \
|
||||
$(6) \
|
||||
$(5) \
|
||||
-c $(3) \
|
||||
-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))
|
||||
-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(6)),$(1),$(3))
|
||||
$(call gb_Trace_EndRange,$(2),PCH)
|
||||
endef
|
||||
|
||||
# No ccache with MSVC, no need to create a checksum for it.
|
||||
# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename)
|
||||
define gb_PrecompiledHeader__sum_command
|
||||
endef
|
||||
|
||||
|
|
Loading…
Reference in a new issue