Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da7c0408 authored by Aron Griffis's avatar Aron Griffis Committed by Sam Ravnborg
Browse files

kbuild: Extend kbuild/defconfig tags support to exuberant ctags



The following patch extends kbuild/defconfig tags support to exuberant
ctags.  The previous support is only for emacs ctags/etags programs.

This patch also corrects the kconfig regex for the emacs invocation.
Previously it would miss some instances because it assumed /^config
instead of /^[ \t]*config

Signed-off-by: default avatarAron Griffis <aron@hp.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 39e6e9cf
Loading
Loading
Loading
Loading
+27 −17
Original line number Original line Diff line number Diff line
@@ -1273,6 +1273,31 @@ define all-defconfigs
	$(call find-sources,'defconfig')
	$(call find-sources,'defconfig')
endef
endef


define xtags
	if $1 --version 2>&1 | grep -iq exuberant; then \
	    $(all-sources) | xargs $1 -a \
		-I __initdata,__exitdata,__acquires,__releases \
		-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
		--extra=+f --c-kinds=+px; \
	    $(all-kconfigs) | xargs $1 -a \
		--langdef=kconfig \
		--language-force=kconfig \
		--regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \
	    $(all-defconfigs) | xargs $1 -a \
		--langdef=dotconfig \
		--language-force=dotconfig \
		--regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
	elif $1 --version 2>&1 | grep -iq emacs; then \
	    $(all-sources) | xargs $1 -a; \
	    $(all-kconfigs) | xargs $1 -a \
		--regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
	    $(all-defconfigs) | xargs $1 -a \
		--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
	else \
	    $(all-sources) | xargs $1 -a; \
	fi
endef

quiet_cmd_cscope-file = FILELST cscope.files
quiet_cmd_cscope-file = FILELST cscope.files
      cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
      cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files


@@ -1286,31 +1311,16 @@ cscope: FORCE
quiet_cmd_TAGS = MAKE   $@
quiet_cmd_TAGS = MAKE   $@
define cmd_TAGS
define cmd_TAGS
	rm -f $@; \
	rm -f $@; \
	ETAGSF=`etags --version | grep -i exuberant >/dev/null &&     \
	$(call xtags,etags)
                echo "-I __initdata,__exitdata,__acquires,__releases  \
                      -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL              \
                      --extra=+f --c-kinds=+px"`;                     \
                $(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
endef


TAGS: FORCE
TAGS: FORCE
	$(call cmd,TAGS)
	$(call cmd,TAGS)



quiet_cmd_tags = MAKE   $@
quiet_cmd_tags = MAKE   $@
define cmd_tags
define cmd_tags
	rm -f $@; \
	rm -f $@; \
	CTAGSF=`ctags --version | grep -i exuberant >/dev/null &&     \
	$(call xtags,ctags)
                echo "-I __initdata,__exitdata,__acquires,__releases  \
                      -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL              \
                      --extra=+f --c-kinds=+px"`;                     \
                $(all-sources) | xargs ctags $$CTAGSF -a
endef
endef


tags: FORCE
tags: FORCE