From patchwork Fri Mar 11 06:59:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masatake YAMATO X-Patchwork-Id: 627401 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2B6xoTO015708 for ; Fri, 11 Mar 2011 06:59:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751333Ab1CKG7t (ORCPT ); Fri, 11 Mar 2011 01:59:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52207 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905Ab1CKG7t (ORCPT ); Fri, 11 Mar 2011 01:59:49 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2B6xnhB011900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Mar 2011 01:59:49 -0500 Received: from localhost (beach.nrt.redhat.com [10.64.200.71]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2B6xlPq025207 for ; Fri, 11 Mar 2011 01:59:48 -0500 Date: Fri, 11 Mar 2011 15:59:47 +0900 (JST) Message-Id: <20110311.155947.824460700302079643.yamato@redhat.com> To: linux-kbuild@vger.kernel.org Subject: [PATCH] Introducing TAGSFALGS From: Masatake YAMATO Organization: Red Hat Japan, Inc. Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 11 Mar 2011 06:59:59 +0000 (UTC) diff --git a/Makefile b/Makefile index 26492be..fd36251 100644 --- a/Makefile +++ b/Makefile @@ -1383,8 +1383,9 @@ clean: $(clean-dirs) # Generate tags for editors # --------------------------------------------------------------------------- +TAGSFLAGS = quiet_cmd_tags = GEN $@ - cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ + cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ $(TAGSFLAGS) tags TAGS cscope gtags: FORCE $(call cmd,tags) diff --git a/scripts/tags.sh b/scripts/tags.sh index bd6185d..53c8989 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -111,17 +111,20 @@ all_defconfigs() docscope() { (echo \-k; echo \-q; all_sources) > cscope.files - cscope -b -f cscope.out + cscope "$@" -b -f cscope.out } dogtags() { - all_sources | gtags -f - + all_sources | gtags "$@" -f - } exuberant() { - all_sources | xargs $1 -a \ + cmd=$1 + shift + + all_sources | xargs $cmd "$@" -a \ -I __initdata,__exitdata,__acquires,__releases \ -I __read_mostly,____cacheline_aligned \ -I ____cacheline_aligned_in_smp \ @@ -134,15 +137,15 @@ exuberant() --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ --regex-c++='/^DEFINE_EVENT\(([^,)]*).*/trace_\1/' - all_kconfigs | xargs $1 -a \ + all_kconfigs | xargs $cmd "$@" -a \ --langdef=kconfig --language-force=kconfig \ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' - all_kconfigs | xargs $1 -a \ + all_kconfigs | xargs $cmd "$@" -a \ --langdef=kconfig --language-force=kconfig \ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/' - all_defconfigs | xargs -r $1 -a \ + all_defconfigs | xargs -r $cmd "$@" -a \ --langdef=dotconfig --language-force=dotconfig \ --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' @@ -150,28 +153,34 @@ exuberant() emacs() { - all_sources | xargs $1 -a \ + cmd=$1 + shift + + all_sources | xargs $cmd "$@" -a \ --regex='/^ENTRY(\([^)]*\)).*/\1/' \ --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' - all_kconfigs | xargs $1 -a \ + all_kconfigs | xargs $cmd "$@" -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' - all_kconfigs | xargs $1 -a \ + all_kconfigs | xargs $cmd "$@" -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/' - all_defconfigs | xargs -r $1 -a \ + all_defconfigs | xargs -r $cmd "$@" -a \ --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/' } xtags() { - if $1 --version 2>&1 | grep -iq exuberant; then - exuberant $1 - elif $1 --version 2>&1 | grep -iq emacs; then - emacs $1 + cmd=$1 + shift + + if $cmd --version 2>&1 | grep -iq exuberant; then + exuberant $cmd "$@" + elif $cmd --version 2>&1 | grep -iq emacs; then + emacs $cmd "$@" else - all_sources | xargs $1 -a + all_sources | xargs $cmd "$@" -a fi } @@ -187,22 +196,25 @@ if [ "${ARCH}" = "um" ]; then fi fi -case "$1" in +target=$1 +shift + +case "$target" in "cscope") - docscope + docscope $@ ;; "gtags") - dogtags + dogtags $@ ;; "tags") rm -f tags - xtags ctags + xtags ctags $@ ;; "TAGS") rm -f TAGS - xtags etags + xtags etags $@ ;; esac