kbuild: support building external modules in a separate build directory
authorMasahiro Yamada <masahiroy@kernel.org>
Sun, 10 Nov 2024 01:34:35 +0000 (10:34 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 27 Nov 2024 23:11:55 +0000 (08:11 +0900)
commit11b3d5175e6bc3779159228e6077be202d2b0069
tree8b85efcc9a4538c3e23c0beb7145f6a55f90f96d
parentbad6beb2c0bb982b830f592a7b3e3eee76cbb85a
kbuild: support building external modules in a separate build directory

There has been a long-standing request to support building external
modules in a separate build directory.

This commit introduces a new environment variable, KBUILD_EXTMOD_OUTPUT,
and its shorthand Make variable, MO.

A simple usage:

 $ make -C <kernel-dir> M=<module-src-dir> MO=<module-build-dir>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Documentation/kbuild/kbuild.rst
Documentation/kbuild/modules.rst
Makefile
scripts/Makefile.host
scripts/Makefile.lib