diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-05-07 16:25:04 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-08 11:27:48 +0200 |
commit | 0cd589cb5f57242b320530920db33b720110d619 (patch) | |
tree | 7331e6505fabfa2c2857eae38d69a2d77b752770 | |
parent | d827219092063c6c4d045463b41fef2c0fc17c10 (diff) |
gbuild: refactor selective symbols again:
The previous commit works but results in a ~0.4 second slowdown on
tail_build, which is completely unacceptable; seems that at the cost of
another ugly global variable in Module.mk we can get the performance back
and then some, so refactor this again...
-rw-r--r-- | solenv/gbuild/CppunitTest.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/Executable.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/Library.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 43 | ||||
-rw-r--r-- | solenv/gbuild/Module.mk | 8 | ||||
-rw-r--r-- | solenv/gbuild/StaticLibrary.mk | 2 |
6 files changed, 17 insertions, 42 deletions
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index 09a1db1ce68b..3c9cd82e2831 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -123,7 +123,7 @@ $(call gb_CppunitTest_get_target,$(1)) : UNO_SERVICES := $(call gb_CppunitTest_get_target,$(1)) : UNO_TYPES := $(call gb_CppunitTest_get_target,$(1)) : DBGSV_ERROR_OUT := shell $(call gb_CppunitTest_get_target,$(1)) : SAL_DIAGNOSE_ABORT := -$$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1)),CppunitTest_$(1))) +$$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1)))) endef diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk index eda569c4995b..2cb23fc90b6d 100644 --- a/solenv/gbuild/Executable.mk +++ b/solenv/gbuild/Executable.mk @@ -59,7 +59,7 @@ $(call gb_Executable_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) \ | $(dir $(call gb_Executable_get_target,$(1))).dir $(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) $(call gb_Executable_Executable_platform,$(1),$(2)) -$$(eval $$(call gb_Module_register_target,$(call gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1)),Executable_$(1))) +$$(eval $$(call gb_Module_register_target,$(call gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1)))) $(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) endef diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index 3a1e3d99b6a4..2c74d6e70d2b 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -75,7 +75,7 @@ $(call gb_Library__get_final_target,$(1)) : $(call gb_Library_get_target,$(1)) $(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) $(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) $(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1))) -$$(eval $$(call gb_Module_register_target,$(call gb_Library__get_final_target,$(1)),$(call gb_Library_get_clean_target,$(1)),Library_$(1))) +$$(eval $$(call gb_Module_register_target,$(call gb_Library__get_final_target,$(1)),$(call gb_Library_get_clean_target,$(1)))) $(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) endef diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index e851dd564659..b71a13b2d1b5 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -36,46 +36,17 @@ # OBJCXXFLAGS # LDFLAGS - -# convert ENABLE_SYMBOLS_FOR from "all -sc/" syntax to a list of target names - -# all targets -gb_Symbols_get_all = \ - $(foreach module,$(gb_Module_ALLMODULES),$(gb_Module_DEBUG_$(module))) - -# all targets in a module -gb_Symbols_expand_module = $(gb_Module_DEBUG_$(1)) - -# expand one item: all->all targets, foo/ -> all targets in foo/, otherwise the item itself -define gb_Symbols_expand_item -$(if $(filter all,$(1)),$(call gb_Symbols_get_all), - $(if $(findstring /,$(1)),$(call gb_Symbols_expand_module,$(1)), - $(if $(findstring _,$(1)),$(1), - $(error no _ or / in --enable-debug item, prepend target type such as Library_ or append / for directory)))) -endef - -# list of items to enable debug for -define gb_Symbols_expand_debug -$(foreach item,$(1),$(if $(findstring -,$(item)),,$(call gb_Symbols_expand_item,$(item)))) -endef - -# list of items to not enable debug for -define gb_Symbols_expand_nodebug -$(foreach item,$(1),$(if $(findstring -,$(item)),$(call gb_Symbols_expand_item,$(patsubst -%,%,$(item))),)) -endef - -# add items to enable debug for, remove items to not enable debug for -# note that there is not ordering and removing takes precedence -gb_Symbols_create_debugfor=$(filter-out $(call gb_Symbols_expand_nodebug,$(1)),$(call gb_Symbols_expand_debug,$(1))) - -# convert the value -gb_ENABLE_SYMBOLS_FOR=$(call gb_Symbols_create_debugfor,$(ENABLE_SYMBOLS_FOR)) +# enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined] +gb_LinkTarget__symbols_enabled = \ + $(and $(if $(filter -$(1),$(ENABLE_SYMBOLS_FOR)),,$(true)),\ + $(or $(gb_Module_CURRENTMODULE_DEBUG_ENABLED),\ + $(filter $(1),$(ENABLE_SYMBOLS_FOR)))) # debug flags, if ENABLE_SYMBOLS is set and the LinkTarget is named # in the list of libraries of ENABLE_SYMBOLS_FOR ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget__get_symbolscflags=$(if $(filter $(1),$(gb_ENABLE_SYMBOLS_FOR)),$(gb_DEBUG_CFLAGS)) -gb_LinkTarget__get_symbolscxxflags=$(if $(filter $(1),$(gb_ENABLE_SYMBOLS_FOR)),$(gb_DEBUG_CFLAGS) $(gb_DEBUG_CXXFLAGS)) +gb_LinkTarget__get_symbolscflags=$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUG_CFLAGS)) +gb_LinkTarget__get_symbolscxxflags=$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUG_CFLAGS) $(gb_DEBUG_CXXFLAGS)) else gb_LinkTarget__get_symbolscflags= gb_LinkTarget__get_symbolscxxflags= diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk index 6e9f8b040edc..486a2fe7d2ac 100644 --- a/solenv/gbuild/Module.mk +++ b/solenv/gbuild/Module.mk @@ -178,6 +178,11 @@ showmodules : $(info $(strip $(gb_Module_ALLMODULES))) @true +# enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined] +gb_Module__debug_enabled = \ + $(and $(if $(filter -$(1)/,$(ENABLE_SYMBOLS_FOR)),,$(true)),\ + $(filter all $(1)/,$(ENABLE_SYMBOLS_FOR))) + define gb_Module_Module gb_Module_ALLMODULES += $(1) gb_Module_MODULELOCATIONS += $(1):$(dir $(realpath $(lastword $(MAKEFILE_LIST)))) @@ -186,6 +191,7 @@ gb_Module_CHECKTARGETSTACK := $(call gb_Module_get_check_target,$(1)) $(gb_Modul gb_Module_SLOWCHECKTARGETSTACK := $(call gb_Module_get_slowcheck_target,$(1)) $(gb_Module_SLOWCHECKTARGETSTACK) gb_Module_SUBSEQUENTCHECKTARGETSTACK := $(call gb_Module_get_subsequentcheck_target,$(1)) $(gb_Module_SUBSEQUENTCHECKTARGETSTACK) gb_Module_CLEANTARGETSTACK := $(call gb_Module_get_clean_target,$(1)) $(gb_Module_CLEANTARGETSTACK) +gb_Module_CURRENTMODULE_DEBUG_ENABLED := $(call gb_Module__debug_enabled,$(1)) endef @@ -196,7 +202,6 @@ endef define gb_Module_register_target gb_Module_CURRENTTARGET := $(1) gb_Module_CURRENTCLEANTARGET := $(2) -gb_Module_DEBUG_$(gb_Module_CURRENTMODULE) += $(3) endef @@ -204,7 +209,6 @@ endef define gb_Module__read_targetfile gb_Module_CURRENTTARGET := gb_Module_CURRENTCLEANTARGET := -gb_Module_CURRENTMODULE := $(1) include $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk ifneq ($$(words $$(gb_Module_CURRENTTARGET)) $$(words $$(gb_Module_CURRENTCLEANTARGET)),1 1) $$(eval $$(call gb_Output_error,No $(3) registered while reading $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk!)) diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk index db93eeaadaaf..9179958f1357 100644 --- a/solenv/gbuild/StaticLibrary.mk +++ b/solenv/gbuild/StaticLibrary.mk @@ -69,7 +69,7 @@ $(call gb_LinkTarget_add_defs,$(2),\ $(call gb_StaticLibrary_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) $(call gb_StaticLibrary_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) $(call gb_StaticLibrary_StaticLibrary_platform,$(1),$(2)) -$$(eval $$(call gb_Module_register_target,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_StaticLibrary_get_clean_target,$(1)),StaticLibrary_$(1))) +$$(eval $$(call gb_Module_register_target,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_StaticLibrary_get_clean_target,$(1)))) $(call gb_Deliver_add_deliverable,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1)) endef |