kbuild: clear KBUILD_MODULES in top Makefile if CONFIG_MODULES=n

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

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
diff --git a/Makefile b/Makefile
index 1f5bbfb..72eb55a 100644
--- a/Makefile
+++ b/Makefile
@@ -1724,6 +1724,10 @@
 
 endif
 
+ifndef CONFIG_MODULES
+KBUILD_MODULES :=
+endif
+
 # Handle descending into subdirectories listed in $(build-dirs)
 # Preset locale variables to speed up the build process. Limit locale
 # tweaks to this spot to avoid wrong language settings when running