linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM
@ 2012-12-03 18:04 Joonsoo Kim
  2012-12-03 18:04 ` [PATCH v2 2/2] scripts/tags.sh: Support compiled source Joonsoo Kim
  2012-12-09 17:51 ` [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM Michal Marek
  0 siblings, 2 replies; 4+ messages in thread
From: Joonsoo Kim @ 2012-12-03 18:04 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, Joonsoo Kim

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"

Signed-off-by: Joonsoo Kim <js1304@gmail.com>
---
v2: change bash specific '[[]]' to 'case in' statement.

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 79fdafb..38483f4 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -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,21 @@ 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
+		case "$i" in
+			*"mach-"${SUBARCH})
+				;;
+			*"plat-"${SUBARCH})
+				;;
+			*)
+				subarchprune="$subarchprune \
+						-wholename $i -prune -o"
+				;;
+		esac
+	done
 fi
 
 remove_structs=
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] scripts/tags.sh: Support compiled source
  2012-12-03 18:04 [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM Joonsoo Kim
@ 2012-12-03 18:04 ` Joonsoo Kim
  2012-12-09 17:53   ` Michal Marek
  2012-12-09 17:51 ` [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM Michal Marek
  1 sibling, 1 reply; 4+ messages in thread
From: Joonsoo Kim @ 2012-12-03 18:04 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, 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 COMPILED_SOURCE=compiled"

It must be executed after building the kernel.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>
---
v2: change bash specific '[[]]' to 'case in' statement.
    use COMPILED_SOURCE env var, instead of abusing SUBARCH

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 38483f4..9c02921 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -96,6 +96,32 @@ all_sources()
 	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 [ "$COMPILED_SOURCE" = "compiled" ]; then
+		all_compiled_sources
+	else
+		all_sources
+	fi
+}
+
 all_kconfigs()
 {
 	for arch in $ALLSOURCE_ARCHS; do
@@ -111,18 +137,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 +200,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,11 +247,10 @@ 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
 }
 
-
 # Support um (which uses SUBARCH)
 if [ "${ARCH}" = "um" ]; then
 	if [ "$SUBARCH" = "i386" ]; then
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM
  2012-12-03 18:04 [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM Joonsoo Kim
  2012-12-03 18:04 ` [PATCH v2 2/2] scripts/tags.sh: Support compiled source Joonsoo Kim
@ 2012-12-09 17:51 ` Michal Marek
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Marek @ 2012-12-09 17:51 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: linux-kernel

On Tue, Dec 04, 2012 at 03:04:32AM +0900, Joonsoo Kim wrote:
> +elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
> +	subarchdir=$(find ${tree}arch/$SRCARCH/ -name mach-* -type d -o \
> +							-name plat-* -type d);

Please quote the patterns, otherwise the shell will expand them if you
have a file named mach-* or plat-* in the top-level directory.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] scripts/tags.sh: Support compiled source
  2012-12-03 18:04 ` [PATCH v2 2/2] scripts/tags.sh: Support compiled source Joonsoo Kim
@ 2012-12-09 17:53   ` Michal Marek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2012-12-09 17:53 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: linux-kernel

On Tue, Dec 04, 2012 at 03:04:33AM +0900, Joonsoo Kim wrote:
> 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>
> ---
> v2: change bash specific '[[]]' to 'case in' statement.
>     use COMPILED_SOURCE env var, instead of abusing SUBARCH

Looks much better, I have only one minor nitpick:


> +	if [ "$COMPILED_SOURCE" = "compiled" ]; then
> +		all_compiled_sources

Please change it to -n "$COMPILED_SOURCE", so that COMPILED_SOURCE=1
works as well.

Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-09 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-03 18:04 [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM Joonsoo Kim
2012-12-03 18:04 ` [PATCH v2 2/2] scripts/tags.sh: Support compiled source Joonsoo Kim
2012-12-09 17:53   ` Michal Marek
2012-12-09 17:51 ` [PATCH v2 1/2] scripts/tags.sh: Support subarch for ARM Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).