The patch titled Subject: scripts/tags.sh: support compiled source, improved precise has been added to the -mm tree. Its filename is scripts-support-compiled-source-improved-precise.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/scripts-support-compiled-source-improved-precise.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/scripts-support-compiled-source-improved-precise.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: xujialu <xujialu@xxxxxxxxx> Subject: scripts/tags.sh: support compiled source, improved precise Original 'COMPILED_SOURCE=1 make cscope' collects nearly 30000 files include too many unused files, this patch precisely collects source files from *.cmd, in this case just 3000 files include dts and dtsi. Usage: 1) COMPILED_SOURCE=1 make {cscope,gtags} 2) COMPILED_SOURCE=1 KBUILD_ABS_SRCTREE=1 make {cscope,gtags} 3) COMPILED_SOURCE=1 ./scripts/tags.sh {cscope,gtags} 4) COMPILED_SOURCE=1 ABSPWD=$PWD/ ./scripts/tags.sh {cscope,gtags} Link: http://lkml.kernel.org/r/20200502052619.26457-2-xujialu@xxxxxxxxx Signed-off-by: xujialu <xujialu@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx> Cc: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/tags.sh | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) --- a/scripts/tags.sh~scripts-support-compiled-source-improved-precise +++ a/scripts/tags.sh @@ -89,22 +89,30 @@ all_sources() find_other_sources '*.[chS]' } +# COMPILED_SOURCE=1 make {cscope,gtags} +# COMPILED_SOURCE=1 KBUILD_ABS_SRCTREE=1 make {cscope,gtags} +# COMPILED_SOURCE=1 ./scripts/tags.sh {cscope,gtags} +# COMPILED_SOURCE=1 ABSPWD=$PWD/ ./scripts/tags.sh {cscope,gtags} +xtags_juggle_list() +{ + SRCTREE=$(realpath ${tree}.) + + cd $(dirname $(find -name .config -print -quit).) + + realpath -e --relative-to=${SRCTREE} $(find -name "*.cmd" -exec \ + grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ | + awk '!a[$0]++') include/generated/autoconf.h | + sed -e "/\.\./d" -e "s,^,${ABSPWD}${tree}," +} + all_compiled_sources() { - for i in $(all_sources); do - case "$i" in - *.[cS]) - j=${i/\.[cS]/\.o} - j="${j#$tree}" - if [ -e $j ]; then - echo $i - fi - ;; - *) - echo $i - ;; - esac - done + # Consider 'git ls-files' features: + # 1) sort and uniq target files + # 2) limit target files by index + # git ls-files $(xtags_juggle_list) + + xtags_juggle_list | sort -u } all_target_sources() _ Patches currently in -mm which might be from xujialu@xxxxxxxxx are scripts-support-compiled-source-improved-precise.patch scripts-add-a-intermediate-file-for-make-gtags.patch