.. | .. |
---|
32 | 32 | ignore="$ignore ( -path ${tree}tools ) -prune -o" |
---|
33 | 33 | fi |
---|
34 | 34 | |
---|
| 35 | +# gtags(1) refuses to index any file outside of its current working dir. |
---|
| 36 | +# If gtags indexing is requested and the build output directory is not |
---|
| 37 | +# the kernel source tree, index all files in absolute-path form. |
---|
| 38 | +if [[ "$1" == "gtags" && -n "${tree}" ]]; then |
---|
| 39 | + tree=$(realpath "$tree")/ |
---|
| 40 | +fi |
---|
| 41 | + |
---|
35 | 42 | # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH |
---|
36 | 43 | if [ "${ALLSOURCE_ARCHS}" = "" ]; then |
---|
37 | 44 | ALLSOURCE_ARCHS=${SRCARCH} |
---|
.. | .. |
---|
95 | 102 | |
---|
96 | 103 | all_compiled_sources() |
---|
97 | 104 | { |
---|
98 | | - realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) \ |
---|
99 | | - include/generated/autoconf.h $(find $ignore -name "*.cmd" -exec \ |
---|
100 | | - grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ | |
---|
101 | | - awk '!a[$0]++') | sort -u |
---|
| 105 | + { |
---|
| 106 | + echo include/generated/autoconf.h |
---|
| 107 | + find $ignore -name "*.cmd" -exec \ |
---|
| 108 | + sed -n -E 's/^source_.* (.*)/\1/p; s/^ (\S.*) \\/\1/p' {} \+ | |
---|
| 109 | + awk '!a[$0]++' |
---|
| 110 | + } | xargs realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) | |
---|
| 111 | + sort -u |
---|
102 | 112 | } |
---|
103 | 113 | |
---|
104 | 114 | all_target_sources() |
---|
.. | .. |
---|
128 | 138 | |
---|
129 | 139 | dogtags() |
---|
130 | 140 | { |
---|
131 | | - all_target_sources | gtags -i -f - |
---|
| 141 | + all_target_sources | gtags -i -C "${tree:-.}" -f - "$PWD" |
---|
132 | 142 | } |
---|
133 | 143 | |
---|
134 | 144 | # Basic regular expressions with an optional /kind-spec/ for ctags and |
---|