kbuild: set y instead of 1 to KBUILD_{BUILTIN,MODULES}

KBUILD_BUILTIN is set to 1 unless you are building only modules.

KBUILD_MODULES is set to 1 when you are building only modules
(a typical use case is "make modules").

It is more useful to set them to 'y' instead, so we can do
something like:

always-$(KBUILD_BUILTIN) += vmlinux.lds

This works equivalently to:

extra-y += vmlinux.lds

This allows us to deprecate extra-y. extra-y and always-y are quite
similar, and we do not need both.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>

+12 -8
+4
Documentation/kbuild/makefiles.rst
··· 291 291 # arch/x86/kernel/Makefile 292 292 extra-y += vmlinux.lds 293 293 294 + extra-y is now deprecated because this is equivalent to: 295 + 296 + always-$(KBUILD_BUILTIN) += vmlinux.lds 297 + 294 298 $(extra-y) should only contain targets needed for vmlinux. 295 299 296 300 Kbuild skips extra-y when vmlinux is apparently not a final goal.
+8 -8
Makefile
··· 749 749 # Normally, just do built-in. 750 750 751 751 KBUILD_MODULES := 752 - KBUILD_BUILTIN := 1 752 + KBUILD_BUILTIN := y 753 753 754 754 # If we have only "make modules", don't compile built-in objects. 755 755 ifeq ($(MAKECMDGOALS),modules) ··· 761 761 # Just "make" or "make all" shall build modules as well 762 762 763 763 ifneq ($(filter all modules nsdeps compile_commands.json clang-%,$(MAKECMDGOALS)),) 764 - KBUILD_MODULES := 1 764 + KBUILD_MODULES := y 765 765 endif 766 766 767 767 ifeq ($(MAKECMDGOALS),) 768 - KBUILD_MODULES := 1 768 + KBUILD_MODULES := y 769 769 endif 770 770 771 771 export KBUILD_MODULES KBUILD_BUILTIN ··· 1193 1193 ifdef CONFIG_TRIM_UNUSED_KSYMS 1194 1194 # For the kernel to actually contain only the needed exported symbols, 1195 1195 # we have to build modules as well to determine what those symbols are. 1196 - KBUILD_MODULES := 1 1196 + KBUILD_MODULES := y 1197 1197 endif 1198 1198 1199 1199 # '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14 ··· 1533 1533 # the built-in objects during the descend as well, in order to 1534 1534 # make sure the checksums are up to date before we record them. 1535 1535 ifdef CONFIG_MODVERSIONS 1536 - KBUILD_BUILTIN := 1 1536 + KBUILD_BUILTIN := y 1537 1537 endif 1538 1538 1539 1539 # Build modules ··· 1542 1542 # *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFO_BTF_MODULES 1543 1543 # is an exception. 1544 1544 ifdef CONFIG_DEBUG_INFO_BTF_MODULES 1545 - KBUILD_BUILTIN := 1 1545 + KBUILD_BUILTIN := y 1546 1546 modules: vmlinux 1547 1547 endif 1548 1548 ··· 1858 1858 1859 1859 # We are always building only modules. 1860 1860 KBUILD_BUILTIN := 1861 - KBUILD_MODULES := 1 1861 + KBUILD_MODULES := y 1862 1862 1863 1863 build-dir := . 1864 1864 ··· 1986 1986 1987 1987 single-goals := $(addprefix $(build-dir)/, $(single-no-ko)) 1988 1988 1989 - KBUILD_MODULES := 1 1989 + KBUILD_MODULES := y 1990 1990 1991 1991 endif 1992 1992