Makefile: respect CONFIG_CC_OPTIMIZE_FOR_DEBUG for host tools
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 16 Jun 2022 11:43:50 +0000 (13:43 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 8 Jul 2022 13:06:57 +0000 (09:06 -0400)
If CONFIG_CC_OPTIMIZE_FOR_DEBUG=y, the host tools should be built with
debug symbols and with reduced optimization.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Makefile

index 93571d3..7f7dd81 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -673,6 +673,12 @@ else
 include/config/auto.conf: ;
 endif # $(dot-config)
 
+ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
+KBUILD_HOSTCFLAGS   := -Wall -Wstrict-prototypes -Og -g -fomit-frame-pointer \
+               $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
+KBUILD_HOSTCXXFLAGS := -Og -g $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
+endif
+
 #
 # Xtensa linker script cannot be preprocessed with -ansi because of
 # preprocessor operations on strings that don't make C identifiers.