Skip to content

Commit

Permalink
kbuild: doc: document subdir-y syntax
Browse files Browse the repository at this point in the history
There is no explanation about subdir-y.

Let's document it.

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Randy Dunlap <[email protected]>
  • Loading branch information
masahir0y committed Dec 21, 2020
1 parent d0e628c commit c0ea806
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Documentation/kbuild/makefiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down

0 comments on commit c0ea806

Please sign in to comment.