linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding symbols in Kconfig and defconfig to TAGS
@ 2006-06-22  3:21 Masatake YAMATO
  2006-06-24 21:52 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Masatake YAMATO @ 2006-06-22  3:21 UTC (permalink / raw)
  To: linux-kernel

I'm using TAGS generated from "make TAGS" to read the kernel source code.

When I met a ifdef block

	  #ifdef CONFIG_FOO
	  	 ...
	  #endif

in the soruce code I would like to know the meaning CONFIG_FOO
to decide whether I should read inside the ifdef block
or not. meaning CONFIG_FOO is well documented in Kconfig.
So it is nice if I can jump to CONFIG_FOO entry in Kconfig
from "#ifdef CONFIG_FOO" with the tag jump.

Here is the patch to add symbols in Kconfig and defconfig to TAGS
in "make TAGS" operation.

Signed-off-by: Masatake YAMATO <jet@gyve.org>

diff --git a/Makefile b/Makefile
index 1700d3f..c2e177e 100644
--- a/Makefile
+++ b/Makefile
@@ -1181,25 +1181,35 @@ endif
 
 ALLSOURCE_ARCHS := $(ARCH)
 
-define all-sources
-	( find $(__srctree) $(RCS_FIND_IGNORE) \
+define find-sources
+        ( find $(__srctree) $(RCS_FIND_IGNORE) \
 	       \( -name include -o -name arch \) -prune -o \
-	       -name '*.[chS]' -print; \
+	       -name $1 -print; \
 	  for ARCH in $(ALLSOURCE_ARCHS) ; do \
 	       find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \
-	            -name '*.[chS]' -print; \
+	            -name $1 -print; \
 	  done ; \
 	  find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
-	       -name '*.[chS]' -print; \
+	       -name $1 -print; \
 	  find $(__srctree)include $(RCS_FIND_IGNORE) \
 	       \( -name config -o -name 'asm-*' \) -prune \
-	       -o -name '*.[chS]' -print; \
+	       -o -name $1 -print; \
 	  for ARCH in $(ALLINCLUDE_ARCHS) ; do \
 	       find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \
-	            -name '*.[chS]' -print; \
+	            -name $1 -print; \
 	  done ; \
 	  find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
-	       -name '*.[chS]' -print )
+	       -name $1 -print )
+endef
+
+define all-sources
+	$(call find-sources,'*.[chS]')
+endef
+define all-kconfigs
+	$(call find-sources,'Kconfig*')
+endef
+define all-defconfigs
+	$(call find-sources,'defconfig')
 endef
 
 quiet_cmd_cscope-file = FILELST cscope.files
@@ -1219,7 +1229,11 @@ define cmd_TAGS
                 echo "-I __initdata,__exitdata,__acquires,__releases  \
                       -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL              \
                       --extra=+f --c-kinds=+px"`;                     \
-                $(all-sources) | xargs etags $$ETAGSF -a
+                $(all-sources) | xargs etags $$ETAGSF -a;             \
+	if test "x$$ETAGSF" = x; then                                 \
+		$(all-kconfigs)   | xargs etags -a --regex='/^config[ \t]+\([a-zA-Z0-9_]+\)/\1/';  \
+		$(all-defconfigs) | xargs etags -a --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
+	fi
 endef
 
 TAGS: FORCE

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

* Re: Adding symbols in Kconfig and defconfig to TAGS
  2006-06-22  3:21 Adding symbols in Kconfig and defconfig to TAGS Masatake YAMATO
@ 2006-06-24 21:52 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2006-06-24 21:52 UTC (permalink / raw)
  To: Masatake YAMATO; +Cc: linux-kernel

On Thu, Jun 22, 2006 at 12:21:20PM +0900, Masatake YAMATO wrote:
> I'm using TAGS generated from "make TAGS" to read the kernel source code.
> 
> When I met a ifdef block
> 
> 	  #ifdef CONFIG_FOO
> 	  	 ...
> 	  #endif
> 
> in the soruce code I would like to know the meaning CONFIG_FOO
> to decide whether I should read inside the ifdef block
> or not. meaning CONFIG_FOO is well documented in Kconfig.
> So it is nice if I can jump to CONFIG_FOO entry in Kconfig
> from "#ifdef CONFIG_FOO" with the tag jump.
> 
> Here is the patch to add symbols in Kconfig and defconfig to TAGS
> in "make TAGS" operation.

Applied after fixing 80 coloumn breakage.

	Sam

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

end of thread, other threads:[~2006-06-24 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-22  3:21 Adding symbols in Kconfig and defconfig to TAGS Masatake YAMATO
2006-06-24 21:52 ` Sam Ravnborg

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).