|
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>
|