Skip to contentSkip to conversation

scripts/tags.sh: Support subarch for ARM

PATCH Superseded Joonsoo Kim 2 participants 4 messages Dec 3, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts/tags.sh: Support subarch for ARM

Current tags.sh doesn't handle subarch for ARM.
There are too many subarch on ARM, it is hard that we locate some functions which are defined in every subarch with tags util family. Therefore support subarch for removing this unconvenience.

We can use ARM subarch functionality like below.
"make cscope O=. SRCARCH=arm SUBARCH=xxx"

scripts/tags.sh +11 -2
index 79fdafb..a400c88 100755
@@ -48,13 +48,14 @@ find_arch_sources()
 	for i in $archincludedir; do
 		prune="$prune -wholename $i -prune -o"
 	done
-	find ${tree}arch/$1 $ignore $prune -name "$2" -print;
+	find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print;
 }
 
 # find sources in arch/$1/include
 find_arch_include_sources()
 {
-	include=$(find ${tree}arch/$1/ -name include -type d);
+	include=$(find ${tree}arch/$1/ $subarchprune \
+					-name include -type d -print);
 	if [ -n "$include" ]; then
 		archincludedir="$archincludedir $include"
 		find $include $ignore -name "$2" -print;
@@ -234,6 +235,14 @@ if [ "${ARCH}" = "um" ]; then
 	else
 		archinclude=${SUBARCH}
 	fi
+elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
+	subarchdir=$(find ${tree}arch/$SRCARCH/ -name mach-* -type d -o \
+							-name plat-* -type d);
+	for i in $subarchdir; do
+		if ! [[ $i =~ .*-${SUBARCH}$ ]]; then
+			subarchprune="$subarchprune -wholename $i -prune -o"
+		fi
+	done
 fi
 
 remove_structs=
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 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 SUBARCH=compiled"

It must be executed after building the kernel.

scripts/tags.sh +31 -5
index a400c88..ef9668c 100755
@@ -96,6 +96,29 @@ all_sources()
 	find_other_sources '*.[chS]'
 }
 
+all_compiled_sources()
+{
+	for i in $(all_sources); do
+		if [[ $i =~ .*c$ || $i =~ .*S$ ]]; then
+			j=${i/\.[cS]/\.o}
+			if [ -e $j ]; then
+				echo $i
+			fi
+		else
+			echo $i
+		fi
+	done
+}
+
+all_target_sources()
+{
+	if [ "$compiled_target" = "true" ]; then
+		all_compiled_sources
+	else
+		all_sources
+	fi
+}
+
 all_kconfigs()
 {
 	for arch in $ALLSOURCE_ARCHS; do
@@ -111,18 +134,18 @@ all_defconfigs()
 
 docscope()
 {
-	(echo \-k; echo \-q; all_sources) > cscope.files
+	(echo \-k; echo \-q; all_target_sources) > cscope.files
 	cscope -b -f cscope.out
 }
 
 dogtags()
 {
-	all_sources | gtags -i -f -
+	all_target_sources | gtags -i -f -
 }
 
 exuberant()
 {
-	all_sources | xargs $1 -a                               \
+	all_target_sources | xargs $1 -a                        \
 	-I __initdata,__exitdata,__acquires,__releases          \
 	-I __read_mostly,____cacheline_aligned                  \
 	-I ____cacheline_aligned_in_smp                         \
@@ -174,7 +197,7 @@ exuberant()
 
 emacs()
 {
-	all_sources | xargs $1 -a                               \
+	all_target_sources | xargs $1 -a                        \
 	--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'            \
 	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
 	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
@@ -221,10 +244,13 @@ xtags()
 	elif $1 --version 2>&1 | grep -iq emacs; then
 		emacs $1
 	else
-		all_sources | xargs $1 -a
+		all_target_sources | xargs $1 -a
         fi
 }
 
+if [ "${SUBARCH}" = "compiled" ]; then
+	compiled_target=true
+fi
 
 # Support um (which uses SUBARCH)
 if [ "${ARCH}" = "um" ]; then
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/2] scripts/tags.sh: Support compiled source

Quoted 6 lines · Joonsoo Kim

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 SUBARCH=compiled"

I like the idea, but please try to come up with a different syntax that does not abuse SUBARCH.

scripts/tags.sh all_sources() · line 103

Quoted 5 lines
scripts/tags.sh +5 -0
+all_compiled_sources()
+{
+	for i in $(all_sources); do
+		if [[ $i =~ .*c$ || $i =~ .*S$ ]]; then
+			j=${i/\.[cS]/\.o}

Please use 'case "$i" in ...' instead of the bash-specific [[ ... ]] construct.

Michal

#3 lore raw

Re: [PATCH 2/2] scripts/tags.sh: Support compiled source

2012/12/4 Michal Marek <[email protected]>:

Quoted 12 lines · Joonsoo Kim
Quoted 6 lines

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 SUBARCH=compiled"

I like the idea, but please try to come up with a different syntax that does not abuse SUBARCH.

Quoted 8 lines

scripts/tags.sh all_sources() · line 103

Quoted 5 lines
scripts/tags.sh +5 -0
+all_compiled_sources()
+{
+     for i in $(all_sources); do
+             if [[ $i =~ .*c$ || $i =~ .*S$ ]]; then
+                     j=${i/\.[cS]/\.o}

Please use 'case "$i" in ...' instead of the bash-specific [[ ... ]] construct.

I send v2 which is fixed according to your comment. Thanks for review.