[PATCH v2 3/4] kbuild: clear KBUILD_MODULES in top Makefile if CONFIG_MODULES=n

From: Masahiro Yamada
Date: Thu Sep 12 2019 - 12:23:10 EST


Do not try to build any module-related artifacts when CONFIG_MODULES
is disabled.

Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---

Changes in v2:
- New patch

Makefile | 4 ++++
scripts/Makefile.build | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index adc0cabe2382..0ecc62dbe234 100644
--- a/Makefile
+++ b/Makefile
@@ -1797,6 +1797,10 @@ single-build = $(if $(filter-out $@/, $(single-no-ko)),1)

endif

+ifndef CONFIG_MODULES
+KBUILD_MODULES :=
+endif
+
# FIXME Should go into a make.lib or something
# ===========================================================================

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index fb29c898604a..aab9a14fa78d 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -76,7 +76,7 @@ else ifneq ($(real-obj-y),)
builtin-target := __warn-orphan-obj-y
endif

-ifeq ($(CONFIG_MODULES)$(need-modorder),y1)
+ifdef need-modorder
modorder-target := $(obj)/modules.order
endif

--
2.17.1