summaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-11-28 20:51:08 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2020-12-21 13:57:07 +0900
commitc0ea806f874eb32894249b4a67c2f2452881b775 (patch)
tree0db0a94c9a5897cc2d8dd6abb679b79ce085178e /Documentation
parentd0e628cd817f3b67ad80cceaf527c7bb37c27b1c (diff)
kbuild: doc: document subdir-y syntax
There is no explanation about subdir-y. Let's document it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/kbuild/makefiles.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 3f1697ce1cd4..d36768cf1250 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -319,6 +319,21 @@ more details, with real examples.
that directory specifies obj-y, those objects will be left orphan.
It is very likely a bug of the Makefile or of dependencies in Kconfig.
+ Kbuild also supports dedicated syntax, subdir-y and subdir-m, for
+ descending into subdirectories. It is a good fit when you know they
+ do not contain kernel-space objects at all. A typical usage is to let
+ Kbuild descend into subdirectories to build tools.
+
+ Examples::
+
+ # scripts/Makefile
+ subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
+ subdir-$(CONFIG_MODVERSIONS) += genksyms
+ subdir-$(CONFIG_SECURITY_SELINUX) += selinux
+
+ Unlike obj-y/m, subdir-y/m does not need the trailing slash since this
+ syntax is always used for directories.
+
It is good practice to use a `CONFIG_` variable when assigning directory
names. This allows kbuild to totally skip the directory if the
corresponding `CONFIG_` option is neither 'y' nor 'm'.