linux/Documentation/kbuild
Masahiro Yamada eb47ee0181 kbuild: add Kbuild bash completion
Kernel build commands can sometimes be long, particularly when
cross-compiling, making them tedious to type and prone to mistypes.

This commit introduces bash completion support for common variables
and targets in Kbuild.

For installation instructions, please refer to the documentation in
Documentation/kbuild/bash-completion.rst.

The following examples demonstrate how this saves typing.

[Example 1] a long command line for cross-compiling

  $ make A<TAB>
   -> completes 'A' to 'ARCH='

  $ make ARCH=<TAB>
   -> displays all supported architectures

  $ make ARCH=arm64 CR<TAB>
   -> completes 'CR' to 'CROSS_COMPILE='

  $ make ARCH=arm64 CROSS_COMPILE=<TAB>
   -> displays installed toolchains

  $ make ARCH=arm64 CROSS_COMPILE=aa<TAB>
   -> completes 'CROSS_COMPILE=aa' to 'CROSS_COMPILE=aarch64-linux-gnu-'

  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- def<TAB>
   -> completes 'def' to 'defconfig'

[Example 2] a single build target

  $ make f<TAB>
   -> completes 'f' to 'fs/'

  $ make fs/<TAB>
   -> displays objects and sub-directories in fs/

  $ make fs/xf<TAB>
   -> completes 'fs/xf' to 'fs/xfs/'

  $ make fs/xfs/l<TAB>
   -> completes 'fs/xfs/l' to 'fs/xfs/libxfs/xfs_'

  $ make fs/xfs/libxfs/xfs_g<TAB>
   -> completes 'fs/xfs/libxfs/xfs_g' to 'fs/xfs/libxfs/xfs_group.o'

This does not aim to provide a complete list of variables and targets,
as there are too many. However, it covers variables and targets used
in common scenarios, and I hope this is useful enough.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Tested-by: Nicolas Schier <n.schier@avm.de>
2025-03-15 21:22:52 +09:00
..
bash-completion.rst kbuild: add Kbuild bash completion 2025-03-15 21:22:52 +09:00
gcc-plugins.rst docs/core-api: expand Fedora instructions for GCC plugins 2022-09-27 13:21:44 -06:00
gendwarfksyms.rst Documentation/kbuild: Add DWARF module versioning 2025-01-11 01:25:26 +09:00
headers_install.rst
index.rst kbuild: add Kbuild bash completion 2025-03-15 21:22:52 +09:00
issues.rst
kbuild.rst kbuild: rust: add PROCMACROLDFLAGS 2025-01-15 09:53:54 +01:00
kconfig-language.rst docs: kconfig: Mention IS_REACHABLE as way for optional dependency 2025-03-15 21:19:44 +09:00
kconfig-macro-language.rst kconfig: doc: fix $(fileno) to $(filename) 2020-12-21 16:01:44 +09:00
Kconfig.recursion-issue-01 docs: kconfig: Fix grammar and formatting 2024-02-15 06:55:47 +09:00
Kconfig.recursion-issue-02 docs: use the lore redirector everywhere 2021-10-12 13:58:19 -06:00
kconfig.rst docs: kbuild/kconfig: reformat/cleanup 2024-02-19 18:20:39 +09:00
Kconfig.select-break
llvm.rst sparc/build: Add SPARC target flags for compiling with clang 2024-11-16 09:52:56 +01:00
makefiles.rst kbuild: rust: add rustc-min-version support function 2025-03-15 21:19:32 +09:00
modules.rst Documentation/kbuild: Document storage of symbol information 2025-01-11 02:36:36 +09:00
reproducible-builds.rst Documentation: kbuild: Add description of git for reproducible builds 2022-10-28 00:16:29 +09:00