summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-04-11 14:24:54 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-04-12 13:57:32 +0200
commitea68de2968c0dbcd8e7549435e829db06795c16d (patch)
tree536e47cf39c4f973b246a0705ec84462369a27da /solenv
parent967717e65fffce20ff6069c2177720c067e174d1 (diff)
use gb_DEBUGINFO_FLAGS consistently in gbuild ExternalProject's
A number of them didn't use it at all, others had it hand-written in various ways. Change-Id: Iaf86325f9cdc032926bac917dc3eef4e34661544 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132818 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/CliLibrary.mk2
-rw-r--r--solenv/gbuild/ExternalProject.mk4
-rw-r--r--solenv/gbuild/LinkTarget.mk13
-rw-r--r--solenv/gbuild/PrecompiledHeaders.mk2
-rw-r--r--solenv/gbuild/gbuild.mk7
5 files changed, 16 insertions, 12 deletions
diff --git a/solenv/gbuild/CliLibrary.mk b/solenv/gbuild/CliLibrary.mk
index e6af83891925..4abd34b42ae3 100644
--- a/solenv/gbuild/CliLibrary.mk
+++ b/solenv/gbuild/CliLibrary.mk
@@ -40,7 +40,7 @@ define gb_CliLibrary__command
$(CLI_CSCFLAGS) \
-target:library \
-out:$(1) \
- $(if $(call gb_LinkTarget__symbols_enabled,$(1)),\
+ $(if $(call gb_target_symbols_enabled,$(1)),\
-debug:pdbonly \
-pdb:$(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/Library/$(notdir $(1)))) \
-keyfile:$(CLI_KEYFILE) \
diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk
index ef10c1d2884f..77a8c85dbf1f 100644
--- a/solenv/gbuild/ExternalProject.mk
+++ b/solenv/gbuild/ExternalProject.mk
@@ -206,6 +206,10 @@ $(call gb_ExternalProject_get_preparation_target,$(1)) : \
endef
+# Returns flags to include in CFLAGS/CXXFLAGS to enable optimizations and/or debugging.
+# gb_ExternalProject_get_build_flags project
+gb_ExternalProject_get_build_flags = $(call gb_LinkTarget__get_debugflags,ExternalProject_$(1))
+
# Run a target command
#
# This provides a wrapper that changes to the right directory,
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 37524f9b59eb..6a0e7580ef22 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -43,18 +43,11 @@
# FYI: on Windows, gb_Library_use_system_win32_libs also calls gb_LinkTarget_add_libs; easy to miss.
gb_LinkTarget__syslib = %@
-# Detect whether symbols should be enabled for the given gbuild target.
-# 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_SYMBOLS_ENABLED),\
- $(filter $(1),$(ENABLE_SYMBOLS_FOR))))
-
# debug flags, if the LinkTarget is named in the list of libraries of ENABLE_SYMBOLS_FOR
gb_LinkTarget__get_debugflags= \
$(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \
$(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS),$(gb_COMPILERNOOPTFLAGS))) \
- $(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
+ $(if $(call gb_target_symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
# T_LDFLAGS is just expanded once. Override the flags here, so that the linker and compiler use the same.
ifeq (EMSCRIPTEN,$(OS))
@@ -64,7 +57,7 @@ else
# but moreover strip debug from libraries for which debuginfo is not wanted
# (some libraries reuse .o files from other libraries, notably unittests)
gb_LinkTarget__get_stripldflags=$(if $(strip $(CFLAGS)$(CXXFLAGS)$(OBJCFLAGS)$(OBJCXXFLAGS)$(LDFLAGS)),,$(gb_LINKERSTRIPDEBUGFLAGS))
-gb_LinkTarget__get_debugldflags=$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_LINKER_DEBUGINFO_FLAGS),$(gb_LINKEROPTFLAGS) $(call gb_LinkTarget__get_stripldflags,$(1)))
+gb_LinkTarget__get_debugldflags=$(if $(call gb_target_symbols_enabled,$(1)),$(gb_LINKER_DEBUGINFO_FLAGS),$(gb_LINKEROPTFLAGS) $(call gb_LinkTarget__get_stripldflags,$(1)))
endif
# generic cflags/cxxflags to use (optimization flags, debug flags)
@@ -1061,7 +1054,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PLUGIN_WARNINGS_AS_ERRORS :=
$(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
$(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
$(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
-$(call gb_LinkTarget_get_target,$(1)) : T_SYMBOLS := $(if $(call gb_LinkTarget__symbols_enabled,$(2)),$(true),$(false))
+$(call gb_LinkTarget_get_target,$(1)) : T_SYMBOLS := $(if $(call gb_target_symbols_enabled,$(2)),$(true),$(false))
$(call gb_LinkTarget_get_target,$(1)) : T_FORCE_COMPILE := $(if $(call gb_LinkTarget__force_compile,$(2)),$(true),$(false))
$(call gb_LinkTarget_get_target,$(1)) : T_CC :=
$(call gb_LinkTarget_get_target,$(1)) : T_CXX :=
diff --git a/solenv/gbuild/PrecompiledHeaders.mk b/solenv/gbuild/PrecompiledHeaders.mk
index bc95f07b47e5..b6d3ecdfe0d9 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -21,7 +21,7 @@
# PrecompiledHeader class
# Use different PCH file depending on whether we use debugging symbols.
-gb_PrecompiledHeader__get_debugdir = $(if $(call gb_LinkTarget__symbols_enabled,$(1)),debug,nodebug)
+gb_PrecompiledHeader__get_debugdir = $(if $(call gb_target_symbols_enabled,$(1)),debug,nodebug)
# $(call gb_PrecompiledHeader_generate_timestamp_rule,linktargetmakefilename)
define gb_PrecompiledHeader_generate_timestamp_rule
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index d5ddcd8925ce..075c029b095d 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -150,6 +150,13 @@ ifeq ($(gb_ENABLE_SYMBOLS_FOR),no)
gb_ENABLE_SYMBOLS_FOR :=
endif
+# Detect whether symbols should be enabled for the given gbuild target.
+# enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
+gb_target_symbols_enabled = \
+ $(and $(if $(filter -$(1),$(ENABLE_SYMBOLS_FOR)),,$(true)),\
+ $(or $(gb_Module_CURRENTMODULE_SYMBOLS_ENABLED),\
+ $(filter $(1),$(ENABLE_SYMBOLS_FOR))))
+
ifeq ($(BLOCK_PCH),)
gb_ENABLE_PCH := $(ENABLE_PCH)
else