From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@intel.com,
Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v6] devtools: add tags and cscope index file generation support
Date: Sat, 29 Apr 2017 16:21:18 +0530 [thread overview]
Message-ID: <20170429105118.23532-1-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <1490171404-16828-1-git-send-email-jerin.jacob@caviumnetworks.com>
This script generates cscope, gtags, and tags index files based on
EAL environment(architecture and OS(linux/bsd)).
Selection of the architecture and OS environment is based on dpdk
configuration target(T=).If EAL environment(T=) is not specified,
the script generates tag files based on available source code.
Usage: make tags|cscope|gtags|etags [T=config]
example usage:
make cscope
make tags T=x86_64-native-linuxapp-gcc
make gtags T=arm64-armv8a-linuxapp-gcc
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v6:
- Addressed all the review comments from Thomas
http://dpdk.org/ml/archives/dev/2017-April/064964.html
v5:
- Added cscope,tags,gtags,etags makefile targets (Cristian)
v4:
- Accommodate the latest "test" directory rework change in master
v3:
- Added etags target for Emacs(John)
- EAL environment(config) is optional now(Thomas)
- Changed bash shebang to /bin/sh (Thomas)
- getopts based -v and -h option (Thomas)
- used $() instead of backquotes (Thomas)
- Removed "make" based frontend to the script to make it inline with
other devtools scripts in DPDK (Jerin)
v2:
- Moved tag.sh to devtools from scripts
- Rebased to master
---
.gitignore | 9 ++
devtools/build-tags.sh | 233 +++++++++++++++++++++++++++++++++++++++++++++++++
mk/rte.sdkroot.mk | 4 +
3 files changed, 246 insertions(+)
create mode 100755 devtools/build-tags.sh
diff --git a/.gitignore b/.gitignore
index c733967a8..6df5ba068 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,12 @@ doc/guides/cryptodevs/overview_feature_table.txt
doc/guides/cryptodevs/overview_cipher_table.txt
doc/guides/cryptodevs/overview_auth_table.txt
doc/guides/cryptodevs/overview_aead_table.txt
+cscope.out.po
+cscope.out.in
+cscope.out
+cscope.files
+GTAGS
+GPATH
+GRTAGS
+tags
+TAGS
diff --git a/devtools/build-tags.sh b/devtools/build-tags.sh
new file mode 100755
index 000000000..2b4258972
--- /dev/null
+++ b/devtools/build-tags.sh
@@ -0,0 +1,233 @@
+#!/bin/sh -e
+# Generate tags or gtags or cscope or etags files
+#
+# BSD LICENSE
+#
+# Copyright 2017 Cavium Networks
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Cavium networks nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+verbose=false
+linux=true
+bsd=true
+x86_32=true
+x86_64=true
+ppc_64=true
+arm_32=true
+arm_64=true
+
+print_usage()
+{
+ echo "Usage: $(basename $0) [-h] [-v] tags|cscope|gtags|etags [config]"
+ echo "Valid configs are:"
+ make showconfigs | sed 's,^,\t,'
+}
+
+while getopts hv ARG ; do
+ case $ARG in
+ v ) verbose=true ;;
+ h ) print_usage; exit 0 ;;
+ ? ) print_usage; exit 1 ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+#ignore version control files
+ignore="( -name .svn -o -name CVS -o -name .hg -o -name .git ) -prune -o"
+
+source_dirs="test app buildtools drivers examples lib"
+
+skip_bsd="( -name bsdapp ) -prune -o"
+skip_linux="( -name linuxapp ) -prune -o"
+skip_arch="( -name arch ) -prune -o"
+skip_sse="( -name *_sse*.[chS] ) -prune -o"
+skip_avx="( -name *_avx*.[chS] ) -prune -o"
+skip_neon="( -name *_neon*.[chS] ) -prune -o"
+skip_altivec="( -name *_altivec*.[chS] ) -prune -o"
+skip_arm64="( -name *arm64*.[chS] ) -prune -o"
+skip_x86="( -name *x86*.[chS] ) -prune -o"
+skip_32b_files="( -name *_32.h ) -prune -o"
+skip_64b_files="( -name *_64.h ) -prune -o"
+
+skiplist="$skip_bsd $skip_linux $skip_arch $skip_sse $skip_avx \
+ $skip_neon $skip_altivec $skip_x86 $skip_arm64"
+
+find_sources()
+{
+ find $1 $ignore $3 -name $2 -not -type l -print
+}
+
+common_sources()
+{
+ find_sources "$source_dirs" '*.[chS]' "$skiplist"
+}
+
+linux_sources()
+{
+ find_sources "lib/librte_eal/linuxapp" '*.[chS]'
+}
+
+bsd_sources()
+{
+ find_sources "lib/librte_eal/bsdapp" '*.[chS]'
+}
+
+arm_common()
+{
+ find_sources "lib/librte_eal/common/arch/arm" '*.[chS]'
+ find_sources "$source_dirs" '*neon*.[chS]'
+}
+
+arm_32_sources()
+{
+ arm_common
+ find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+ "$skip_64b_files"
+}
+
+arm_64_sources()
+{
+ arm_common
+ find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+ "$skip_32b_files"
+ find_sources "$source_dirs" '*arm64.[chS]'
+}
+
+x86_common()
+{
+ find_sources "lib/librte_eal/common/arch/x86" '*.[chS]'
+
+ find_sources "examples/performance-thread/common/arch/x86" '*.[chS]'
+ find_sources "$source_dirs" '*_sse*.[chS]'
+ find_sources "$source_dirs" '*_avx*.[chS]'
+ find_sources "$source_dirs" '*x86.[chS]'
+}
+
+x86_32_sources()
+{
+ x86_common
+ find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+ "$skip_64b_files"
+}
+
+x86_64_sources()
+{
+ x86_common
+ find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+ "$skip_32b_files"
+}
+
+ppc_64_sources()
+{
+ find_sources "lib/librte_eal/common/arch/ppc_64" '*.[chS]'
+ find_sources "lib/librte_eal/common/include/arch/ppc_64" '*.[chS]'
+ find_sources "$source_dirs" '*altivec*.[chS]'
+}
+
+check_valid_target()
+{
+ cfgfound=false
+ allconfigs=$(make showconfigs)
+ for cfg in $allconfigs ; do
+ if [ "$cfg" = "$1" ] ; then
+ cfgfound=true
+ fi
+ done
+ if ! $cfgfound ; then
+ echo "Invalid config: $1"
+ print_usage
+ exit 0
+ fi
+}
+
+if [ -n "$2" ]; then
+ check_valid_target $2
+
+ echo $2 | grep -q "linuxapp-" || linux=false
+ echo $2 | grep -q "bsdapp-" || bsd=false
+ echo $2 | grep -q "x86_64-" || x86_64=false
+ echo $2 | grep -q "arm-" || arm_32=false
+ echo $2 | grep -q "arm64-" || arm_64=false
+ echo $2 | grep -q "ppc_64-" || ppc_64=false
+ echo $2 | grep -q -e "i686-" -e "x32-" || x86_32=false
+fi
+
+all_sources()
+{
+ common_sources
+ if $linux ; then linux_sources ; fi
+ if $bsd ; then bsd_sources ; fi
+ if $x86_64 ; then x86_64_sources ; fi
+ if $x86_32 ; then x86_32_sources ; fi
+ if $ppc_64 ; then ppc_64_sources ; fi
+ if $arm_32 ; then arm_32_sources ; fi
+ if $arm_64 ; then arm_64_sources ; fi
+}
+
+show_flags()
+{
+ if $verbose ; then
+ echo "mode: $1"
+ echo "config: $2"
+ echo "linux: $linux"
+ echo "bsd: $bsd"
+ echo "x86_32: $x86_32"
+ echo "x86_64: $x86_64"
+ echo "ppc_64: $ppc_64"
+ echo "arm_32: $arm_32"
+ echo "arm_64: $arm_64"
+ fi
+}
+
+# Move to the root of the git tree
+cd $(dirname $0)/..
+
+case "$1" in
+ "cscope")
+ show_flags $1 $2
+ all_sources > cscope.files
+ cscope -q -b -f cscope.out
+ ;;
+ "gtags")
+ show_flags $1 $2
+ all_sources | gtags -i -f -
+ ;;
+ "tags")
+ show_flags $1 $2
+ rm -f tags
+ all_sources | xargs ctags -a
+ ;;
+ "etags")
+ show_flags $1 $2
+ rm -f TAGS
+ all_sources | xargs etags -a
+ ;;
+ *)
+ echo "Invalid mode: $1"
+ print_usage
+ ;;
+esac
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 685d2f55b..2843b7de1 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -92,6 +92,10 @@ default: all
config showconfigs showversion showversionum:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@
+.PHONY: cscope gtags tags etags
+cscope gtags tags etags:
+ $(Q)$(RTE_SDK)/devtools/build-tags.sh $@ $T
+
.PHONY: test test-basic test-fast test-ring test-mempool test-perf coverage
test test-basic test-fast test-ring test-mempool test-perf coverage:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktest.mk $@
--
2.12.2
next prev parent reply other threads:[~2017-04-29 10:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-27 0:12 [dpdk-dev] [PATCH] tools: " Jerin Jacob
2016-11-28 5:50 ` Yuanhan Liu
2017-01-12 14:19 ` Ferruh Yigit
2017-01-13 2:50 ` Jerin Jacob
2017-01-13 12:23 ` Mcnamara, John
2017-01-17 8:41 ` [dpdk-dev] [PATCH v2] " Jerin Jacob
2017-02-27 14:18 ` Thomas Monjalon
2017-02-28 14:12 ` Jerin Jacob
2017-03-01 10:51 ` Thomas Monjalon
2017-03-13 14:18 ` [dpdk-dev] [PATCH v3] devtools: " Jerin Jacob
2017-03-19 10:52 ` [dpdk-dev] [PATCH v4] " Jerin Jacob
2017-03-20 10:15 ` Dumitrescu, Cristian
2017-03-21 4:05 ` Jerin Jacob
2017-03-22 8:30 ` [dpdk-dev] [PATCH v5] " Jerin Jacob
2017-04-14 12:44 ` Jerin Jacob
2017-04-28 8:50 ` Thomas Monjalon
2017-04-29 10:51 ` Jerin Jacob [this message]
2017-04-30 10:45 ` [dpdk-dev] [PATCH v6] " Thomas Monjalon
2017-04-30 11:00 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170429105118.23532-1-jerin.jacob@caviumnetworks.com \
--to=jerin.jacob@caviumnetworks.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).