summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-08-02 00:00:49 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2020-08-10 01:32:59 +0900
commite0fe0bbe57b8d708a18756be5bc289bdaf78d2a8 (patch)
tree72bf8b470a3707d7fa61cc05ebb13667f4120d63 /Makefile
parentfaabed295cccc2aba2b67f2e7b309f2892d55004 (diff)
downloadlwn-e0fe0bbe57b8d708a18756be5bc289bdaf78d2a8.tar.gz
lwn-e0fe0bbe57b8d708a18756be5bc289bdaf78d2a8.zip
kbuild: include scripts/Makefile.* only when relevant CONFIG is enabled
Currently, the top Makefile includes all of scripts/Makefile.<feature> even if the associated CONFIG option is disabled. Do not include unneeded Makefiles in order to slightly optimize the parse stage. Include $(include-y), and ignore $(include-). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 9 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index ebf4d3ce492c..483456d5dd3e 100644
--- a/Makefile
+++ b/Makefile
@@ -745,9 +745,6 @@ endif
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
-include scripts/Makefile.kcov
-include scripts/Makefile.gcc-plugins
-
ifdef CONFIG_READABLE_ASM
# Disable optimizations that make assembler listings hard to read.
# reorder blocks reorders the control in the function
@@ -948,10 +945,15 @@ ifdef CONFIG_RETPOLINE
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
endif
-include scripts/Makefile.kasan
-include scripts/Makefile.extrawarn
-include scripts/Makefile.ubsan
-include scripts/Makefile.kcsan
+# include additional Makefiles when needed
+include-y := scripts/Makefile.extrawarn
+include-$(CONFIG_KASAN) += scripts/Makefile.kasan
+include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan
+include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan
+include-$(CONFIG_KCOV) += scripts/Makefile.kcov
+include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins
+
+include $(addprefix $(srctree)/, $(include-y))
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
KBUILD_CPPFLAGS += $(KCPPFLAGS)