Search notes:

Makefile

The Makefile in the root of the Linux kernel source tree is essentially used to build
The top level Makefile includes arch/$SRCARCH/Makefile which supplies architecture-specific information to the top Makefile.

Version variables

The top of the Makefile defines a few version related variables:
VERSION = 6
PATCHLEVEL = 5
SUBLEVEL = 0
EXTRAVERSION = -rc7
NAME = Hurr durr I'ma ninja sloth
$ make -s kernelversion
6.5.0-rc7
Compare with include/config/kernel.release (if it exists) and include/generated/uapi/linux/version.h (if it exists).

Included files

scripts/Kbuild.include Definition of convenience variables such as comma, quote etc., comparison macros (test-ge, test-lt) and more such stuff
scripts/subarch.include Assign value to SUBARCH
scripts/Makefile.clang if CC_VERSION_TEXT contains clang
scripts/Makefile.compiler If need-compiler is defined
arch/$(SRCARCH)/Makefile For example arch/x86/Makefile
include/config/auto.conf If need-config is defined.
scripts/Makefile.extrawarn
scripts/Makefile.debug if CONFIG_DEBUG_INFO = y
scripts/Makefile.btf if CONFIG_DEBUG_INFO_BTF = y
scripts/Makefile.kasan if CONFIG_KASAN = y
scripts/Makefile.kcsan if CONFIG_KCSAN = y
scripts/Makefile.kmsan if CONFIG_KMSAN = y
scripts/Makefile.ubsan if CONFIG_UBSAN = y
scripts/Makefile.kcov if CONFIG_KCOV = y
scripts/Makefile.randstruct if CONFIG_RANDSTRUCT = y
scripts/Makefile.gcc-plugins if CONFIG_GCC_PLUGINS = y

See also

The Makefile includes include/config/auto.conf.cmd
$ make [target]
Documentation/kbuild/makefiles.rst
Linux kernel source tree

Links

Linux Kernel Makefiles
Process of the Linux kernel building

Index