Explorar o código

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>
Joonsoo Kim %!s(int64=13) %!d(string=hai) anos
pai
achega
923e02ecf3
Modificáronse 1 ficheiros con 31 adicións e 6 borrados
  1. 31 6
      scripts/tags.sh

+ 31 - 6
scripts/tags.sh

@@ -96,6 +96,32 @@ all_sources()
 	find_other_sources '*.[chS]'
 	find_other_sources '*.[chS]'
 }
 }
 
 
+all_compiled_sources()
+{
+	for i in $(all_sources); do
+		case "$i" in
+			*.[cS])
+				j=${i/\.[cS]/\.o}
+				if [ -e $j ]; then
+					echo $i
+				fi
+				;;
+			*)
+				echo $i
+				;;
+		esac
+	done
+}
+
+all_target_sources()
+{
+	if [ -n "$COMPILED_SOURCE" ]; then
+		all_compiled_sources
+	else
+		all_sources
+	fi
+}
+
 all_kconfigs()
 all_kconfigs()
 {
 {
 	for arch in $ALLSOURCE_ARCHS; do
 	for arch in $ALLSOURCE_ARCHS; do
@@ -111,18 +137,18 @@ all_defconfigs()
 
 
 docscope()
 docscope()
 {
 {
-	(echo \-k; echo \-q; all_sources) > cscope.files
+	(echo \-k; echo \-q; all_target_sources) > cscope.files
 	cscope -b -f cscope.out
 	cscope -b -f cscope.out
 }
 }
 
 
 dogtags()
 dogtags()
 {
 {
-	all_sources | gtags -i -f -
+	all_target_sources | gtags -i -f -
 }
 }
 
 
 exuberant()
 exuberant()
 {
 {
-	all_sources | xargs $1 -a                               \
+	all_target_sources | xargs $1 -a                        \
 	-I __initdata,__exitdata,__acquires,__releases          \
 	-I __initdata,__exitdata,__acquires,__releases          \
 	-I __read_mostly,____cacheline_aligned                  \
 	-I __read_mostly,____cacheline_aligned                  \
 	-I ____cacheline_aligned_in_smp                         \
 	-I ____cacheline_aligned_in_smp                         \
@@ -174,7 +200,7 @@ exuberant()
 
 
 emacs()
 emacs()
 {
 {
-	all_sources | xargs $1 -a                               \
+	all_target_sources | xargs $1 -a                        \
 	--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'            \
 	--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'            \
 	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
 	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
 	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
 	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
@@ -221,11 +247,10 @@ xtags()
 	elif $1 --version 2>&1 | grep -iq emacs; then
 	elif $1 --version 2>&1 | grep -iq emacs; then
 		emacs $1
 		emacs $1
 	else
 	else
-		all_sources | xargs $1 -a
+		all_target_sources | xargs $1 -a
         fi
         fi
 }
 }
 
 
-
 # Support um (which uses SUBARCH)
 # Support um (which uses SUBARCH)
 if [ "${ARCH}" = "um" ]; then
 if [ "${ARCH}" = "um" ]; then
 	if [ "$SUBARCH" = "i386" ]; then
 	if [ "$SUBARCH" = "i386" ]; then