gtags considers any file outside of its current working directory "outside the source tree" and refuses to index it. For O= kernel builds, scripts/tags.sh invokes gtags with the current working directory set to ${O}. This leads to gtags ignoring the entire kernel source and generating an empty index. For O= builds, set gtags' working directory to the kernel source tree and explicitly set its output path through parameters instead. Signed-off-by: Ahmed S. Darwish <darwi@xxxxxxxxxxxxx> --- scripts/tags.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index ea31640b2671..1a6db535503b 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -131,7 +131,14 @@ docscope() dogtags() { - all_target_sources | gtags -i -f - + # gtags refuses to index any file outside of the current working + # directory. For O= builds, set the current working directory to + # the kernel source tree and the output tags dir to ${O}. + suffixparams= + if [ -v O ]; then + suffixparams="-C $tree $O" + fi + all_target_sources | gtags -i -f - $suffixparams } # Basic regular expressions with an optional /kind-spec/ for ctags and -- 2.30.2