framework/Library_fwk.mk | 11 ++++------ solenv/gbuild/LinkTarget.mk | 41 +++++++++++++++++++++++++------------- solenv/gbuild/platform/freebsd.mk | 4 +++ solenv/gbuild/platform/linux.mk | 4 +++ solenv/gbuild/platform/macosx.mk | 5 ++++ solenv/gbuild/platform/os2.mk | 4 +++ solenv/gbuild/platform/solaris.mk | 5 ++++ solenv/gbuild/platform/windows.mk | 6 ++++- 8 files changed, 60 insertions(+), 20 deletions(-)
New commits: commit 9a6267c4a54c7321b50196c7b47dd98118f595f3 Author: Don Lewis <truck...@apache.org> Date: Tue Dec 12 18:45:51 2017 +0000 Improvements to per-object optimization overrides in gbuild: * Less Library.mk editing required to add an optimization exception than what has been normally done to date. * Add a variable to specify an override to -O1 instead of only allowing -O0. * Don't lose debug flags when overriding optimization. Convert the recent Mac optimization override in framework/Library_fwk.mk to the new style. Improvements to Windows debug builds in gbuild: * There are multiple dependency paths that trigger compiling a source file. Add a target specific $(PDBFILE) to the root of each so that $(PDBFILE) is set properly when compiling. Note: $(PDBFILE) is not getting set when compiling the sources for the per-module (Google Test) tests. * Don't inadvertantly disable the use of pre-compiled headers when enabling debug (not specific to Windows). Note: If both debug and pre-compiled headers are enabled, building of modules that contain more than one library will fail due to limitations of Visual Studio. The problem is that when we build the precompiled header, the output file(s) are based on the module name. Even though each Library_*.mk specifies the rule to build the precompiled header, it is only built once for the module. Visual Studio requires that the $(PDBFILE) used when compiling the sources match the $(PDBFILE) used when compiling the precompiled header, but the value of $(PDBFILE) is specific to each library. The best fix would be to compile the headers once for each library and stash the output in a per-library specific place, but this requires some fairly extensive changes. Another potential fix would be to use -Z7 optimization so that the debug information is stored in the object files. diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index fd66cae227c7..449800331fce 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -61,6 +61,11 @@ $(eval $(call gb_Library_add_linked_libs,fwk,\ $(gb_STDLIBS) \ )) +# i126622 - Base 4.1.2 does not open Tables and Queries in Mac OSX +ifeq ($(OS),MACOSX) + $(call gb_LinkTarget_set_cxx_optimization,framework/source/loadenv/loadenv,$(gb_COMPILEROPT1FLAGS)) +endif + $(eval $(call gb_Library_add_exception_objects,fwk,\ framework/source/accelerators/acceleratorcache \ framework/source/accelerators/acceleratorconfiguration \ @@ -190,10 +195,4 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\ framework/source/xml/imagesdocumenthandler \ )) -# i126622 - Base 4.1.2 does not open Tables and Queries in Mac OSX -ifeq ($(OS),MACOSX) - $(call gb_CxxObject_get_target,framework/source/loadenv/loadenv):\ - T_CXXFLAGS := $(gb_LinkTarget_CXXFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) $(gb_COMPILERNOOPTFLAGS) -endif - # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index 18e79404a1aa..faa7c2863ff8 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -109,10 +109,10 @@ gb_CxxObject_get_source = $(1)/$(2).cxx define gb_CxxObject__set_pchflags ifeq ($(gb_ENABLE_PCH),$(true)) ifneq ($(strip $$(PCH_NAME)),) -ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(DEFS))) +ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(CXXFLAGS) $$(DEFS))) $$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME)) else -ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(DEFS))) +ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(CXXFLAGS) $$(DEFS))) $$@ : PCHFLAGS := $$(call gb_NoexPrecompiledHeader_get_enableflags,$$(PCH_NAME)) else $$(info No precompiled header available for $$*.) @@ -333,12 +333,12 @@ $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS := $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS := $(call gb_LinkTarget_get_headers_target,$(1)) \ -$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(CFLAGS) +$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(call gb_LinkTarget_get_headers_target,$(1)) \ -$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(CXXFLAGS) -$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS) $(OBJCXXFLAGS) +$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $$(CXXFLAGS) +$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS) $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) $(call gb_LinkTarget_get_headers_target,$(1)) \ @@ -357,8 +357,8 @@ $(call gb_LinkTarget_get_target,$(1)) : VERSIONMAP := $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS := -$(call gb_LinkTarget_get_headers_target,$(1)) \ -$(call gb_LinkTarget_get_target,$(1)) : PDBFILE := +#$(call gb_LinkTarget_get_headers_target,$(1)) \ +#$(call gb_LinkTarget_get_target,$(1)) : PDBFILE := $(call gb_LinkTarget_get_target,$(1)) : NATIVERES := ifeq ($(gb_FULLDEPS),$(true)) @@ -367,10 +367,10 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS := -$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(CFLAGS) +$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) $(call gb_LinkTarget_get_dep_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) -$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(CXXFLAGS) -$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS) $(OBJCXXFLAGS) +$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $$(CXXFLAGS) +$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS) $(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) $(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) $(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE) @@ -477,7 +477,22 @@ ifeq ($(gb_FULLDEPS),$(true)) $(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := $(2) endif endif +endef + +define gb_LinkTarget_set_c_optimization +$(call gb_CObject_get_target,$(1)) : CFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CFLAGS)) $(2) +endef + +define gb_LinkTarget_set_cxx_optimization +$(call gb_CxxObject_get_target,$(1)) : CXXFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CXXFLAGS)) $(2) +endef + +define gb_LinkTarget_set_gencxx_optimization +$(call gb_GenCxxObject_get_target,$(1)) : CXXFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CXXFLAGS)) $(2) +endef +define gb_LinkTarget_set_objcxx_optimization +$(call gb_ObjCxxObject_get_target,$(1)) : OBJCXXFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(OBJCXXFLAGS)) $(2) endef define gb_LinkTarget_set_include @@ -635,7 +650,7 @@ $(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2) $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2)) $(call gb_GenCxxObject_get_source,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) -$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3) $(CXXFLAGS) +$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3) ifeq ($(gb_FULLDEPS),$(true)) $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2) @@ -645,11 +660,11 @@ endif endef define gb_LinkTarget_add_noexception_object -$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS) $(CXXFLAGS)) +$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS)) endef define gb_LinkTarget_add_exception_object -$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(CXXFLAGS)) +$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS)) endef define gb_LinkTarget_add_cobjects diff --git a/solenv/gbuild/platform/freebsd.mk b/solenv/gbuild/platform/freebsd.mk index 8e1fe297b4e2..94786d431513 100644 --- a/solenv/gbuild/platform/freebsd.mk +++ b/solenv/gbuild/platform/freebsd.mk @@ -152,8 +152,10 @@ endif ifeq ($(gb_DEBUGLEVEL),2) gb_COMPILEROPTFLAGS := -O0 +gb_COMPILEROPT1FLAGS := -O0 else gb_COMPILEROPTFLAGS := -Os +gb_COMPILEROPT1FLAGS := -O1 endif gb_COMPILERNOOPTFLAGS := -O0 @@ -179,6 +181,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CC) \ $(DEFS) \ $(T_CFLAGS) \ + $(CFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ @@ -204,6 +207,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CXX) \ $(DEFS) \ $(T_CXXFLAGS) \ + $(CXXFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk index 29d006244bc2..ac0d3aa0273a 100644 --- a/solenv/gbuild/platform/linux.mk +++ b/solenv/gbuild/platform/linux.mk @@ -158,8 +158,10 @@ endif ifeq ($(gb_DEBUGLEVEL),2) gb_COMPILEROPTFLAGS := -O0 +gb_COMPILEROPT1FLAGS := -O0 else gb_COMPILEROPTFLAGS := -Os +gb_COMPILEROPT1FLAGS := -O1 endif gb_COMPILERNOOPTFLAGS := -O0 @@ -185,6 +187,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CC) \ $(DEFS) \ $(T_CFLAGS) \ + $(CFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ @@ -210,6 +213,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CXX) \ $(DEFS) \ $(T_CXXFLAGS) \ + $(CXXFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 7ec6a66a7155..273276c93b62 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -150,8 +150,10 @@ endif ifeq ($(gb_DEBUGLEVEL),2) gb_COMPILEROPTFLAGS := -O0 +gb_COMPILEROPT1FLAGS := -O0 else gb_COMPILEROPTFLAGS := -O2 +gb_COMPILEROPT1FLAGS := -O1 endif gb_COMPILERNOOPTFLAGS := -O0 @@ -184,6 +186,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CC) \ $(DEFS) \ $(T_CFLAGS) \ + $(CFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ @@ -203,6 +206,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CXX) \ $(DEFS) \ $(T_CXXFLAGS) \ + $(CXXFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ @@ -221,6 +225,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CXX) \ $(DEFS) \ $(T_OBJCXXFLAGS) \ + $(OBJCXXFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ diff --git a/solenv/gbuild/platform/os2.mk b/solenv/gbuild/platform/os2.mk index 2ff75021c9aa..edc4d14f5402 100644 --- a/solenv/gbuild/platform/os2.mk +++ b/solenv/gbuild/platform/os2.mk @@ -141,9 +141,11 @@ endif ifeq ($(gb_DEBUGLEVEL),2) gb_COMPILEROPTFLAGS := -O0 +gb_COMPILEROPT1FLAGS := -O0 #gb_LinkTarget_LDFLAGS += -DEBUG else gb_COMPILEROPTFLAGS := -Os +gb_COMPILEROPT1FLAGS := -O1 endif gb_COMPILERNOOPTFLAGS := -O0 @@ -171,6 +173,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CC) \ $(DEFS) \ $(T_CFLAGS) \ + $(CFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ @@ -190,6 +193,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CXX) \ $(DEFS) \ $(T_CXXFLAGS) \ + $(CXXFLAGS) \ -c $(3) \ -o $(1) \ -MMD -MT $(1) \ diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index e28309e8ca00..4a03d777f51c 100644 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -109,15 +109,18 @@ gb_DEBUG_CFLAGS := -g ifeq ($(gb_DEBUGLEVEL),2) gb_COMPILEROPTFLAGS := +gb_COMPILEROPT1FLAGS := else ifeq ($(CPUNAME),INTEL) gb_COMPILEROPTFLAGS := -xarch=generic -xO3 +gb_COMPILEROPT1FLAGS := -xarch=generic -xO1 else # ifeq ($(CPUNAME),SPARC) # -m32 -xarch=sparc restrict target to 32 bit sparc # -xO3 optimization level 3 # -xspace don't do optimizations which do increase binary size # -xprefetch=yes do prefetching (helps on UltraSparc III) gb_COMPILEROPTFLAGS := -m32 -xarch=sparc -xO3 -xspace -xprefetch=yes +gb_COMPILEROPT1FLAGS := -m32 -xarch=sparc -xO1 -xspace -xprefetch=yes endif endif @@ -156,6 +159,7 @@ $(call gb_Helper_abbreviate_dirs,\ -xMF $(4) \ $(DEFS) \ $(T_CFLAGS) \ + $(CFLAGS) \ -I$(dir $(3)) \ $(INCLUDE)) endef @@ -170,6 +174,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(gb_CXX) \ $(DEFS) \ $(T_CXXFLAGS) \ + $(CXXFLAGS) \ -c $(3) \ -o $(1) \ -xMMD \ diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk index ecdcf4485720..0214539b2fa0 100644 --- a/solenv/gbuild/platform/windows.mk +++ b/solenv/gbuild/platform/windows.mk @@ -280,6 +280,7 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(DEFS) \ $(T_CFLAGS) \ -Fd$(PDBFILE) \ + $(CFLAGS) \ $(PCHFLAGS) \ -I$(dir $(3)) \ $(INCLUDE) \ @@ -300,6 +301,7 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(DEFS) \ $(T_CXXFLAGS) \ -Fd$(PDBFILE) \ + $(CXXFLAGS) \ $(PCHFLAGS) \ -I$(dir $(3)) \ $(INCLUDE_STL) $(INCLUDE) \ @@ -549,7 +551,9 @@ $(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3),$(1)) $(call gb_LinkTarget_get_target,$(2)) \ $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2)) - +ifeq ($(gb_FULLDEPS),$(true)) +$(call gb_LinkTarget_get_dep_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2)) +endif endef define gb_Library_add_default_nativeres _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits