Commit 953fae66d124486c9e284806429c52c5402f59ac

Authored by Alexey Dobriyan
Committed by Sam Ravnborg
1 parent 0bb98e2318

kbuild: fix tags generation of config symbols

commit 4f628248a578585472e19e4cba2c604643af8c6c aka "kbuild: reintroduce
ALLSOURCE_ARCHS support for tags/cscope" breaks tags generation for
Kconfig symbols.

Steps to reproduce:

	make tags
	vi -t PROC_FS

It should jump to 'config PROC_FS' line.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Tested-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 1 changed file with 4 additions and 1 deletions Inline Diff

1 #!/bin/sh 1 #!/bin/sh
2 # Generate tags or cscope files 2 # Generate tags or cscope files
3 # Usage tags.sh <mode> 3 # Usage tags.sh <mode>
4 # 4 #
5 # mode may be any of: tags, TAGS, cscope 5 # mode may be any of: tags, TAGS, cscope
6 # 6 #
7 # Uses the following environment variables: 7 # Uses the following environment variables:
8 # ARCH, SUBARCH, srctree, src, obj 8 # ARCH, SUBARCH, srctree, src, obj
9 9
10 if [ "$KBUILD_VERBOSE" = "1" ]; then 10 if [ "$KBUILD_VERBOSE" = "1" ]; then
11 set -x 11 set -x
12 fi 12 fi
13 13
14 # This is a duplicate of RCS_FIND_IGNORE without escaped '()' 14 # This is a duplicate of RCS_FIND_IGNORE without escaped '()'
15 ignore="( -name SCCS -o -name BitKeeper -o -name .svn -o \ 15 ignore="( -name SCCS -o -name BitKeeper -o -name .svn -o \
16 -name CVS -o -name .pc -o -name .hg -o \ 16 -name CVS -o -name .pc -o -name .hg -o \
17 -name .git ) \ 17 -name .git ) \
18 -prune -o" 18 -prune -o"
19 19
20 # Do not use full path is we do not use O=.. builds 20 # Do not use full path is we do not use O=.. builds
21 if [ "${KBUILD_SRC}" = "" ]; then 21 if [ "${KBUILD_SRC}" = "" ]; then
22 tree= 22 tree=
23 else 23 else
24 tree=${srctree}/ 24 tree=${srctree}/
25 fi 25 fi
26 26
27 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH 27 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH
28 if [ "${ALLSOURCE_ARCHS}" = "" ]; then 28 if [ "${ALLSOURCE_ARCHS}" = "" ]; then
29 ALLSOURCE_ARCHS=${SRCARCH} 29 ALLSOURCE_ARCHS=${SRCARCH}
30 fi 30 fi
31 31
32 # find sources in arch/$ARCH 32 # find sources in arch/$ARCH
33 find_arch_sources() 33 find_arch_sources()
34 { 34 {
35 find ${tree}arch/$1 $ignore -name "$2" -print; 35 find ${tree}arch/$1 $ignore -name "$2" -print;
36 } 36 }
37 37
38 # find sources in arch/$1/include 38 # find sources in arch/$1/include
39 find_arch_include_sources() 39 find_arch_include_sources()
40 { 40 {
41 find ${tree}arch/$1/include $ignore -name "$2" -print; 41 find ${tree}arch/$1/include $ignore -name "$2" -print;
42 } 42 }
43 43
44 # find sources in include/ 44 # find sources in include/
45 find_include_sources() 45 find_include_sources()
46 { 46 {
47 find ${tree}include $ignore -name config -prune -o -name "$1" -print; 47 find ${tree}include $ignore -name config -prune -o -name "$1" -print;
48 } 48 }
49 49
50 # find sources in rest of tree 50 # find sources in rest of tree
51 # we could benefit from a list of dirs to search in here 51 # we could benefit from a list of dirs to search in here
52 find_other_sources() 52 find_other_sources()
53 { 53 {
54 find ${tree}* $ignore \ 54 find ${tree}* $ignore \
55 \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ 55 \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
56 -name "$1" -print; 56 -name "$1" -print;
57 } 57 }
58 58
59 find_sources() 59 find_sources()
60 { 60 {
61 find_arch_sources $1 "$2" 61 find_arch_sources $1 "$2"
62 } 62 }
63 63
64 all_sources() 64 all_sources()
65 { 65 {
66 for arch in $ALLSOURCE_ARCHS 66 for arch in $ALLSOURCE_ARCHS
67 do 67 do
68 find_sources $arch '*.[chS]' 68 find_sources $arch '*.[chS]'
69 done 69 done
70 if [ ! -z "$archinclude" ]; then 70 if [ ! -z "$archinclude" ]; then
71 find_arch_include_sources $archinclude '*.[chS]' 71 find_arch_include_sources $archinclude '*.[chS]'
72 fi 72 fi
73 find_include_sources '*.[chS]' 73 find_include_sources '*.[chS]'
74 find_other_sources '*.[chS]' 74 find_other_sources '*.[chS]'
75 } 75 }
76 76
77 all_kconfigs() 77 all_kconfigs()
78 { 78 {
79 find_sources $ALLSOURCE_ARCHS 'Kconfig*' 79 for arch in $ALLSOURCE_ARCHS; do
80 find_sources $arch 'Kconfig*'
81 done
82 find_other_sources 'Kconfig*'
80 } 83 }
81 84
82 all_defconfigs() 85 all_defconfigs()
83 { 86 {
84 find_sources $ALLSOURCE_ARCHS "defconfig" 87 find_sources $ALLSOURCE_ARCHS "defconfig"
85 } 88 }
86 89
87 docscope() 90 docscope()
88 { 91 {
89 (echo \-k; echo \-q; all_sources) > cscope.files 92 (echo \-k; echo \-q; all_sources) > cscope.files
90 cscope -b -f cscope.out 93 cscope -b -f cscope.out
91 } 94 }
92 95
93 exuberant() 96 exuberant()
94 { 97 {
95 all_sources | xargs $1 -a \ 98 all_sources | xargs $1 -a \
96 -I __initdata,__exitdata,__acquires,__releases \ 99 -I __initdata,__exitdata,__acquires,__releases \
97 -I __read_mostly,____cacheline_aligned \ 100 -I __read_mostly,____cacheline_aligned \
98 -I ____cacheline_aligned_in_smp \ 101 -I ____cacheline_aligned_in_smp \
99 -I ____cacheline_internodealigned_in_smp \ 102 -I ____cacheline_internodealigned_in_smp \
100 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 103 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
101 --extra=+f --c-kinds=+px \ 104 --extra=+f --c-kinds=+px \
102 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' 105 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'
103 106
104 all_kconfigs | xargs $1 -a \ 107 all_kconfigs | xargs $1 -a \
105 --langdef=kconfig --language-force=kconfig \ 108 --langdef=kconfig --language-force=kconfig \
106 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' 109 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'
107 110
108 all_kconfigs | xargs $1 -a \ 111 all_kconfigs | xargs $1 -a \
109 --langdef=kconfig --language-force=kconfig \ 112 --langdef=kconfig --language-force=kconfig \
110 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/' 113 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
111 114
112 all_defconfigs | xargs -r $1 -a \ 115 all_defconfigs | xargs -r $1 -a \
113 --langdef=dotconfig --language-force=dotconfig \ 116 --langdef=dotconfig --language-force=dotconfig \
114 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' 117 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
115 118
116 } 119 }
117 120
118 emacs() 121 emacs()
119 { 122 {
120 all_sources | xargs $1 -a 123 all_sources | xargs $1 -a
121 124
122 all_kconfigs | xargs $1 -a \ 125 all_kconfigs | xargs $1 -a \
123 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' 126 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
124 127
125 all_kconfigs | xargs $1 -a \ 128 all_kconfigs | xargs $1 -a \
126 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/' 129 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
127 130
128 all_defconfigs | xargs -r $1 -a \ 131 all_defconfigs | xargs -r $1 -a \
129 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/' 132 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
130 } 133 }
131 134
132 xtags() 135 xtags()
133 { 136 {
134 if $1 --version 2>&1 | grep -iq exuberant; then 137 if $1 --version 2>&1 | grep -iq exuberant; then
135 exuberant $1 138 exuberant $1
136 elif $1 --version 2>&1 | grep -iq emacs; then 139 elif $1 --version 2>&1 | grep -iq emacs; then
137 emacs $1 140 emacs $1
138 else 141 else
139 all_sources | xargs $1 -a 142 all_sources | xargs $1 -a
140 fi 143 fi
141 } 144 }
142 145
143 146
144 # Support um (which uses SUBARCH) 147 # Support um (which uses SUBARCH)
145 if [ "${ARCH}" = "um" ]; then 148 if [ "${ARCH}" = "um" ]; then
146 if [ "$SUBARCH" = "i386" ]; then 149 if [ "$SUBARCH" = "i386" ]; then
147 archinclude=x86 150 archinclude=x86
148 elif [ "$SUBARCH" = "x86_64" ]; then 151 elif [ "$SUBARCH" = "x86_64" ]; then
149 archinclude=x86 152 archinclude=x86
150 else 153 else
151 archinclude=${SUBARCH} 154 archinclude=${SUBARCH}
152 fi 155 fi
153 fi 156 fi
154 157
155 case "$1" in 158 case "$1" in
156 "cscope") 159 "cscope")
157 docscope 160 docscope
158 ;; 161 ;;
159 162
160 "tags") 163 "tags")
161 xtags ctags 164 xtags ctags
162 ;; 165 ;;
163 166
164 "TAGS") 167 "TAGS")
165 xtags etags 168 xtags etags
166 ;; 169 ;;
167 esac 170 esac
168 171