[openwrt/openwrt] rules.mk: respect the empty CONFIG_HOST_FLAGS_OPT

LEDE Commits lede-commits at lists.infradead.org
Fri May 16 11:42:46 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/17eeb6c3faf5a1130738498c60766227b655d6bb

commit 17eeb6c3faf5a1130738498c60766227b655d6bb
Author: Shiji Yang <yangshiji66 at outlook.com>
AuthorDate: Fri May 16 19:30:30 2025 +0800

    rules.mk: respect the empty CONFIG_HOST_FLAGS_OPT
    
    Currently, the empty CONFIG_HOST_FLAGS_OPT will be overridden by
    "-O2". Fix this issue by checking if its parent menuconfig symbol
    CONFIG_OPTIMIZE_HOST_TOOLS was defined.
    
    Fixes: e3bec5692c50 ("rules.mk: set default host tools GCC optimization level to -O2")
    Reported-by: Christian Marangi <ansuelsmth at gmail.com>
    Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
    Link: https://github.com/openwrt/openwrt/pull/18815
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 rules.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules.mk b/rules.mk
index 3971852f45..929d8e00e8 100644
--- a/rules.mk
+++ b/rules.mk
@@ -278,7 +278,7 @@ PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
 
 export PKG_CONFIG
 
-HOST_FLAGS_OPT:=$(if $(CONFIG_HOST_FLAGS_OPT),$(call qstrip,$(CONFIG_HOST_FLAGS_OPT)),"-O2")
+HOST_FLAGS_OPT:=$(if $(CONFIG_OPTIMIZE_HOST_TOOLS),$(call qstrip,$(CONFIG_HOST_FLAGS_OPT)),-O2)
 HOST_FLAGS_STRIP:=$(call qstrip,$(CONFIG_HOST_FLAGS_STRIP))
 HOST_EXTRA_CFLAGS:=$(call qstrip,$(CONFIG_HOST_EXTRA_CFLAGS))
 HOST_EXTRA_CXXFLAGS:=$(call qstrip,$(CONFIG_HOST_EXTRA_CXXFLAGS))




More information about the lede-commits mailing list