[OpenWrt-Devel] [PATCH 6/6] build: add option to warn on recursive dependency

Eneas U de Queiroz cotequeiroz at gmail.com
Mon Apr 6 16:10:36 EDT 2020

This addes the option to treat recursive dependencies as warnings
instead of errors, by running make with WARN_RECURSIVE_DEP=1.

Note that the script/config targets will not get rebuilt when you add or
remove WARN_RECURSIVE_DEP while running make.  One must run
'make config-clean' before building config with a different setting.

Signed-off-by: Eneas U de Queiroz <cotequeiroz at gmail.com>
 include/toplevel.mk     | 2 +-
 scripts/config/README   | 4 ++++
 scripts/config/symbol.c | 5 +++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/toplevel.mk b/include/toplevel.mk
index 2965f75c7c..def80503dd 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -102,7 +102,7 @@ prepare-tmpinfo: FORCE
 ifneq ($(DISTRO_PKG_CONFIG),)
 scripts/config/%onf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
-scripts/config/%onf: CFLAGS+= -O2
+scripts/config/%onf: CFLAGS+= -O2 $(if $(WARN_RECURSIVE_DEP),-DWARN_RECURSIVE_DEP)
 	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config $(notdir $@) CC="$(HOSTCC_WRAPPER)"
diff --git a/scripts/config/README b/scripts/config/README
index f84a0134b3..91019b0e5b 100644
--- a/scripts/config/README
+++ b/scripts/config/README
@@ -16,6 +16,10 @@ OpenWrt Buildroot:
  - reverted an upstream change that avoids writing symbols that are not
    visible to .config, which breaks OpenWrt busybox's '.config' generation
+ - add a compilation option (-DWARN_RECURSIVE_DEP) to treat recursive deps
+   as a warning, avoiding a complete build failure because of unrelated or
+   minor recursive deps, or making a scrict check before commiting a change
+   that may cause one.
 For a full list of changes, see the repository at:
diff --git a/scripts/config/symbol.c b/scripts/config/symbol.c
index b1dd9be29d..5c6f540314 100644
--- a/scripts/config/symbol.c
+++ b/scripts/config/symbol.c
@@ -1250,6 +1250,11 @@ struct symbol *sym_check_deps(struct symbol *sym)
 		sym->flags &= ~SYMBOL_CHECK;
+	if (sym2 && sym2 == sym)
+		sym2 = NULL;
 	return sym2;

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list