Skip to content

Commit 923e02e

Browse files
JoonsooKimmichal42
authored andcommitted
scripts/tags.sh: Support compiled source
We usually have interst in compiled files only, because they are strongly related to individual's work. Current tags.sh can't select compiled files, so support it. We can use this functionality like below. "make cscope O=. SRCARCH=xxxx COMPILED_SOURCE=compiled" It must be executed after building the kernel. Signed-off-by: Joonsoo Kim <js1304@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent 5965850 commit 923e02e

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

scripts/tags.sh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ all_sources()
9696
find_other_sources '*.[chS]'
9797
}
9898

99+
all_compiled_sources()
100+
{
101+
for i in $(all_sources); do
102+
case "$i" in
103+
*.[cS])
104+
j=${i/\.[cS]/\.o}
105+
if [ -e $j ]; then
106+
echo $i
107+
fi
108+
;;
109+
*)
110+
echo $i
111+
;;
112+
esac
113+
done
114+
}
115+
116+
all_target_sources()
117+
{
118+
if [ -n "$COMPILED_SOURCE" ]; then
119+
all_compiled_sources
120+
else
121+
all_sources
122+
fi
123+
}
124+
99125
all_kconfigs()
100126
{
101127
for arch in $ALLSOURCE_ARCHS; do
@@ -111,18 +137,18 @@ all_defconfigs()
111137

112138
docscope()
113139
{
114-
(echo \-k; echo \-q; all_sources) > cscope.files
140+
(echo \-k; echo \-q; all_target_sources) > cscope.files
115141
cscope -b -f cscope.out
116142
}
117143

118144
dogtags()
119145
{
120-
all_sources | gtags -i -f -
146+
all_target_sources | gtags -i -f -
121147
}
122148

123149
exuberant()
124150
{
125-
all_sources | xargs $1 -a \
151+
all_target_sources | xargs $1 -a \
126152
-I __initdata,__exitdata,__acquires,__releases \
127153
-I __read_mostly,____cacheline_aligned \
128154
-I ____cacheline_aligned_in_smp \
@@ -174,7 +200,7 @@ exuberant()
174200

175201
emacs()
176202
{
177-
all_sources | xargs $1 -a \
203+
all_target_sources | xargs $1 -a \
178204
--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
179205
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
180206
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
@@ -221,11 +247,10 @@ xtags()
221247
elif $1 --version 2>&1 | grep -iq emacs; then
222248
emacs $1
223249
else
224-
all_sources | xargs $1 -a
250+
all_target_sources | xargs $1 -a
225251
fi
226252
}
227253

228-
229254
# Support um (which uses SUBARCH)
230255
if [ "${ARCH}" = "um" ]; then
231256
if [ "$SUBARCH" = "i386" ]; then

0 commit comments

Comments
 (0)