All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: add tags and cscope index file generation support
@ 2016-11-27  0:12 Jerin Jacob
  2016-11-28  5:50 ` Yuanhan Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Jerin Jacob @ 2016-11-27  0:12 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, Jerin Jacob

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

example usage:
make tags T=x86_64-native-linuxapp-gcc
make cscope T=x86_64-native-linuxapp-gcc
make gtags T=x86_64-native-linuxapp-gcc

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 .gitignore        |   8 ++
 mk/rte.sdkroot.mk |   4 +
 scripts/tags.sh   | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100755 scripts/tags.sh

diff --git a/.gitignore b/.gitignore
index a722abe..76bcae2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,9 @@
 doc/guides/nics/overview_table.txt
+cscope.out.po
+cscope.out.in
+cscope.out
+cscope.files
+GTAGS
+GPATH
+GRTAGS
+tags
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 04ad523..de6355a 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
+cscope gtags tags:
+	$(Q)$(RTE_SDK)/scripts/tags.sh $@
+
 .PHONY: test fast_test ring_test mempool_test perf_test coverage
 test fast_test ring_test mempool_test perf_test coverage:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktest.mk $@
diff --git a/scripts/tags.sh b/scripts/tags.sh
new file mode 100755
index 0000000..82c1a2a
--- /dev/null
+++ b/scripts/tags.sh
@@ -0,0 +1,251 @@
+#!/bin/bash
+# Generate tags or gtags or cscope files
+# Usage tags.sh <mode> T=<target> [VERBOSE=1]
+# set -x
+
+verbose=false
+linuxapp=false
+bsdapp=false
+x86_64=false
+arm=false
+arm64=false
+ia_32=false
+ppc_64=false
+tile=false
+
+if [ "$VERBOSE" = "1" ]; then
+	verbose=true
+fi
+
+#ignore version control files
+ignore="( -name .svn -o -name CVS -o -name .hg -o -name .git ) -prune -o"
+
+source_dirs="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"
+}
+
+linuxapp_sources()
+{
+	find_sources "lib/librte_eal/linuxapp" '*.[chS]'
+}
+
+bsdapp_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_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+arm64_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					 "$skip_32b_files"
+	find_sources "${source_dirs}" '*arm64.[chS]'
+}
+
+ia_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]'
+}
+
+i686_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+x86_64_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_32b_files"
+}
+
+ppc64_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]'
+}
+
+tile_sources()
+{
+	find_sources "lib/librte_eal/common/arch/tile" '*.[chS]'
+	find_sources "lib/librte_eal/common/include/arch/tile" '*.[chS]'
+}
+
+config_file()
+{
+	if [ -f $RTE_OUTPUT/include/rte_config.h ]; then
+		ls $RTE_OUTPUT/include/rte_config.h
+	fi
+}
+
+usage()
+{
+	if [ "$1" = 'tags' ] ; then
+		echo "Generate tags file for editors"
+	fi
+	if [ "$1" = 'cscope' ] ; then
+		echo "Generate cscope index"
+	fi
+	if [ "$1" = 'gtags' ] ; then
+		echo "Generate GNU GLOBAL index"
+	fi
+	echo "Usage: make tags|cscope|gtags T=<target> [VERBOSE=1]"
+	echo "Valid targets are:"
+	make showconfigs | sed 's,^,\t,'
+}
+
+check_valid_config()
+{
+	cfgfound=false
+	allconfigs=`make showconfigs`
+	for cfg in $allconfigs
+	do
+		if [ "$cfg" = "$1" ] ; then
+			cfgfound=true
+		fi
+	done
+	$cfgfound || echo "Invalid config: $1"
+	$cfgfound || usage $2
+	$cfgfound || exit 0
+}
+
+if [ -n "$T" ]; then
+	check_valid_config $T $1
+
+	if [ `echo $T | grep -c "linuxapp-" ` -gt 0 ]; then
+		linuxapp=true
+	fi
+
+	if [ `echo $T | grep -c "bsdapp-" ` -gt 0 ]; then
+		bsdapp=true
+	fi
+
+	if [ `echo $T | grep -c "x86_64-" ` -gt 0  ]; then
+		x86_64=true
+	fi
+
+	if [ `echo $T | grep -c "i686-" ` -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ `echo $T | grep -c "x32-" ` -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ `echo $T | grep -c "arm-" ` -gt 0 ]; then
+		arm=true
+	fi
+
+	if [ `echo $T | grep -c "arm64-" ` -gt 0 ]; then
+		arm64=true
+	fi
+
+	if [ `echo $T | grep -c "ppc_64-" ` -gt 0 ]; then
+		ppc_64=true
+	fi
+
+	if [ `echo $T | grep -c "tile-" ` -gt 0 ]; then
+		tile=true
+	fi
+
+	$verbose && echo "linuxapp: $linuxapp"
+	$verbose && echo "bsdapp:   $bsdapp"
+	$verbose && echo "ia_32:    $ia_32"
+	$verbose && echo "x86_64:   $x86_64"
+	$verbose && echo "arm:      $arm"
+	$verbose && echo "arm64:    $arm64"
+	$verbose && echo "ppc_64:   $ppc_64"
+	$verbose && echo "tile:     $tile"
+	$verbose && echo "build:    $RTE_OUTPUT"
+else
+	usage $1
+	exit
+fi
+
+all_sources()
+{
+	common_sources
+	$linuxapp && linuxapp_sources
+	$bsdapp && bsdapp_sources
+	$x86_64 && x86_64_sources
+	$ia_32 && i686_sources
+	$arm && arm_sources
+	$arm64 && arm64_sources
+	$ppc_64 && ppc64_sources
+	$tile && tile_sources
+	config_file
+}
+
+docscope()
+{
+	all_sources > cscope.files
+	cscope -q -b -f cscope.out
+}
+
+dogtags()
+{
+	all_sources | gtags -i -f -
+}
+
+doctags()
+{
+	all_sources | xargs ctags -a
+}
+
+case "$1" in
+	"cscope")
+		docscope
+		;;
+
+	"gtags")
+		dogtags
+		;;
+	"tags")
+		rm -f tags
+		doctags
+		;;
+esac
-- 
2.5.5

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

* Re: [PATCH] tools: add tags and cscope index file generation support
  2016-11-27  0:12 [PATCH] tools: add tags and cscope index file generation support Jerin Jacob
@ 2016-11-28  5:50 ` Yuanhan Liu
  2017-01-12 14:19 ` Ferruh Yigit
  2017-01-17  8:41 ` [PATCH v2] " Jerin Jacob
  2 siblings, 0 replies; 19+ messages in thread
From: Yuanhan Liu @ 2016-11-28  5:50 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, thomas.monjalon

On Sun, Nov 27, 2016 at 05:42:42AM +0530, Jerin Jacob wrote:
> 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=)
> 
> example usage:
> make tags T=x86_64-native-linuxapp-gcc
> make cscope T=x86_64-native-linuxapp-gcc
> make gtags T=x86_64-native-linuxapp-gcc
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

It's handy. Thanks!

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

	--yliu

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

* Re: [PATCH] tools: add tags and cscope index file generation support
  2016-11-27  0:12 [PATCH] tools: add tags and cscope index file generation support 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-17  8:41 ` [PATCH v2] " Jerin Jacob
  2 siblings, 1 reply; 19+ messages in thread
From: Ferruh Yigit @ 2017-01-12 14:19 UTC (permalink / raw)
  To: Jerin Jacob, dev; +Cc: thomas.monjalon

On 11/27/2016 12:12 AM, Jerin Jacob wrote:
> 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=)
> 
> example usage:
> make tags T=x86_64-native-linuxapp-gcc
> make cscope T=x86_64-native-linuxapp-gcc
> make gtags T=x86_64-native-linuxapp-gcc
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

<...>

> +
> +if [ -n "$T" ]; then
<...>
> +	usage $1
> +	exit

I would prefer fallback to RTE_TARGET parsing, or processing all files (
cscope -Rqn ), instead of exiting here, but that is your call.


Also "tags.sh" needs to be moved into "devtools" after latest updates.


Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

* Re: [PATCH] tools: add tags and cscope index file generation support
  2017-01-12 14:19 ` Ferruh Yigit
@ 2017-01-13  2:50   ` Jerin Jacob
  2017-01-13 12:23     ` Mcnamara, John
  0 siblings, 1 reply; 19+ messages in thread
From: Jerin Jacob @ 2017-01-13  2:50 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, thomas.monjalon

On Thu, Jan 12, 2017 at 02:19:44PM +0000, Ferruh Yigit wrote:
> On 11/27/2016 12:12 AM, Jerin Jacob wrote:
> > 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=)
> > 
> > example usage:
> > make tags T=x86_64-native-linuxapp-gcc
> > make cscope T=x86_64-native-linuxapp-gcc
> > make gtags T=x86_64-native-linuxapp-gcc
> > 
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> 
> <...>
> 
> > +
> > +if [ -n "$T" ]; then
> <...>
> > +	usage $1
> > +	exit
> 
> I would prefer fallback to RTE_TARGET parsing, or processing all files (
> cscope -Rqn ), instead of exiting here, but that is your call.

I would prefer avoid any fallback(sometimes RTE_TARGET can be "build" also) and
print the usage and exit error if the requirements are not meet.

> 
> 
> Also "tags.sh" needs to be moved into "devtools" after latest updates.

Sure. I will send v2 to address this.

> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Thanks for the review.

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

* Re: [PATCH] tools: add tags and cscope index file generation support
  2017-01-13  2:50   ` Jerin Jacob
@ 2017-01-13 12:23     ` Mcnamara, John
  0 siblings, 0 replies; 19+ messages in thread
From: Mcnamara, John @ 2017-01-13 12:23 UTC (permalink / raw)
  To: Jerin Jacob, Yigit, Ferruh; +Cc: dev, thomas.monjalon

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> Sent: Friday, January 13, 2017 2:50 AM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; thomas.monjalon@6wind.com
> Subject: Re: [dpdk-dev] [PATCH] tools: add tags and cscope index file
> generation support
> 
> On Thu, Jan 12, 2017 at 02:19:44PM +0000, Ferruh Yigit wrote:
> > On 11/27/2016 12:12 AM, Jerin Jacob wrote:
> > > 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=)
> > >
> > > example usage:
> > > make tags T=x86_64-native-linuxapp-gcc make cscope
> > > T=x86_64-native-linuxapp-gcc make gtags T=x86_64-native-linuxapp-gcc
> > >
> > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> >
> > <...>
> >
> > > +
> > > +if [ -n "$T" ]; then
> > <...>
> > > +	usage $1
> > > +	exit
> >
> > I would prefer fallback to RTE_TARGET parsing, or processing all files
> > ( cscope -Rqn ), instead of exiting here, but that is your call.
> 
> I would prefer avoid any fallback(sometimes RTE_TARGET can be "build"
> also) and print the usage and exit error if the requirements are not meet.
> 
> >
> >
> > Also "tags.sh" needs to be moved into "devtools" after latest updates.
> 
> Sure. I will send v2 to address this.

Very handy. +1.

Could you also add an etags target, for Emacs. Either separately like the 
gtags target or just add it to the tags target:
 
    doetags()
    {
        all_sources | xargs etags -a
    }
    
    # or:

    doctags()
    {
        all_sources | xargs ctags -a
        all_sources | xargs etags -a
    }

It create a TAGS file which should be added to the gitignore rules.

Thanks,

John

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

* [PATCH v2] tools: add tags and cscope index file generation support
  2016-11-27  0:12 [PATCH] tools: add tags and cscope index file generation support Jerin Jacob
  2016-11-28  5:50 ` Yuanhan Liu
  2017-01-12 14:19 ` Ferruh Yigit
@ 2017-01-17  8:41 ` Jerin Jacob
  2017-02-27 14:18   ` Thomas Monjalon
  2017-03-13 14:18   ` [PATCH v3] devtools: " Jerin Jacob
  2 siblings, 2 replies; 19+ messages in thread
From: Jerin Jacob @ 2017-01-17  8:41 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, ferruh.yigit, Jerin Jacob

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

example usage:
make tags T=x86_64-native-linuxapp-gcc
make cscope T=x86_64-native-linuxapp-gcc
make gtags T=x86_64-native-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>
---
v2:

1) Moved tag.sh to devtools from scripts
2) Rebased to master

---
 .gitignore        |   8 ++
 devtools/tags.sh  | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 mk/rte.sdkroot.mk |   4 +
 3 files changed, 263 insertions(+)
 create mode 100755 devtools/tags.sh

diff --git a/.gitignore b/.gitignore
index a722abe..76bcae2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,9 @@
 doc/guides/nics/overview_table.txt
+cscope.out.po
+cscope.out.in
+cscope.out
+cscope.files
+GTAGS
+GPATH
+GRTAGS
+tags
diff --git a/devtools/tags.sh b/devtools/tags.sh
new file mode 100755
index 0000000..82c1a2a
--- /dev/null
+++ b/devtools/tags.sh
@@ -0,0 +1,251 @@
+#!/bin/bash
+# Generate tags or gtags or cscope files
+# Usage tags.sh <mode> T=<target> [VERBOSE=1]
+# set -x
+
+verbose=false
+linuxapp=false
+bsdapp=false
+x86_64=false
+arm=false
+arm64=false
+ia_32=false
+ppc_64=false
+tile=false
+
+if [ "$VERBOSE" = "1" ]; then
+	verbose=true
+fi
+
+#ignore version control files
+ignore="( -name .svn -o -name CVS -o -name .hg -o -name .git ) -prune -o"
+
+source_dirs="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"
+}
+
+linuxapp_sources()
+{
+	find_sources "lib/librte_eal/linuxapp" '*.[chS]'
+}
+
+bsdapp_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_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+arm64_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					 "$skip_32b_files"
+	find_sources "${source_dirs}" '*arm64.[chS]'
+}
+
+ia_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]'
+}
+
+i686_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+x86_64_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_32b_files"
+}
+
+ppc64_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]'
+}
+
+tile_sources()
+{
+	find_sources "lib/librte_eal/common/arch/tile" '*.[chS]'
+	find_sources "lib/librte_eal/common/include/arch/tile" '*.[chS]'
+}
+
+config_file()
+{
+	if [ -f $RTE_OUTPUT/include/rte_config.h ]; then
+		ls $RTE_OUTPUT/include/rte_config.h
+	fi
+}
+
+usage()
+{
+	if [ "$1" = 'tags' ] ; then
+		echo "Generate tags file for editors"
+	fi
+	if [ "$1" = 'cscope' ] ; then
+		echo "Generate cscope index"
+	fi
+	if [ "$1" = 'gtags' ] ; then
+		echo "Generate GNU GLOBAL index"
+	fi
+	echo "Usage: make tags|cscope|gtags T=<target> [VERBOSE=1]"
+	echo "Valid targets are:"
+	make showconfigs | sed 's,^,\t,'
+}
+
+check_valid_config()
+{
+	cfgfound=false
+	allconfigs=`make showconfigs`
+	for cfg in $allconfigs
+	do
+		if [ "$cfg" = "$1" ] ; then
+			cfgfound=true
+		fi
+	done
+	$cfgfound || echo "Invalid config: $1"
+	$cfgfound || usage $2
+	$cfgfound || exit 0
+}
+
+if [ -n "$T" ]; then
+	check_valid_config $T $1
+
+	if [ `echo $T | grep -c "linuxapp-" ` -gt 0 ]; then
+		linuxapp=true
+	fi
+
+	if [ `echo $T | grep -c "bsdapp-" ` -gt 0 ]; then
+		bsdapp=true
+	fi
+
+	if [ `echo $T | grep -c "x86_64-" ` -gt 0  ]; then
+		x86_64=true
+	fi
+
+	if [ `echo $T | grep -c "i686-" ` -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ `echo $T | grep -c "x32-" ` -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ `echo $T | grep -c "arm-" ` -gt 0 ]; then
+		arm=true
+	fi
+
+	if [ `echo $T | grep -c "arm64-" ` -gt 0 ]; then
+		arm64=true
+	fi
+
+	if [ `echo $T | grep -c "ppc_64-" ` -gt 0 ]; then
+		ppc_64=true
+	fi
+
+	if [ `echo $T | grep -c "tile-" ` -gt 0 ]; then
+		tile=true
+	fi
+
+	$verbose && echo "linuxapp: $linuxapp"
+	$verbose && echo "bsdapp:   $bsdapp"
+	$verbose && echo "ia_32:    $ia_32"
+	$verbose && echo "x86_64:   $x86_64"
+	$verbose && echo "arm:      $arm"
+	$verbose && echo "arm64:    $arm64"
+	$verbose && echo "ppc_64:   $ppc_64"
+	$verbose && echo "tile:     $tile"
+	$verbose && echo "build:    $RTE_OUTPUT"
+else
+	usage $1
+	exit
+fi
+
+all_sources()
+{
+	common_sources
+	$linuxapp && linuxapp_sources
+	$bsdapp && bsdapp_sources
+	$x86_64 && x86_64_sources
+	$ia_32 && i686_sources
+	$arm && arm_sources
+	$arm64 && arm64_sources
+	$ppc_64 && ppc64_sources
+	$tile && tile_sources
+	config_file
+}
+
+docscope()
+{
+	all_sources > cscope.files
+	cscope -q -b -f cscope.out
+}
+
+dogtags()
+{
+	all_sources | gtags -i -f -
+}
+
+doctags()
+{
+	all_sources | xargs ctags -a
+}
+
+case "$1" in
+	"cscope")
+		docscope
+		;;
+
+	"gtags")
+		dogtags
+		;;
+	"tags")
+		rm -f tags
+		doctags
+		;;
+esac
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 04ad523..5802644 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
+cscope gtags tags:
+	$(Q)$(RTE_SDK)/devtools/tags.sh $@
+
 .PHONY: test fast_test ring_test mempool_test perf_test coverage
 test fast_test ring_test mempool_test perf_test coverage:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktest.mk $@
-- 
2.5.5

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

* Re: [PATCH v2] tools: add tags and cscope index file generation support
  2017-01-17  8:41 ` [PATCH v2] " Jerin Jacob
@ 2017-02-27 14:18   ` Thomas Monjalon
  2017-02-28 14:12     ` Jerin Jacob
  2017-03-13 14:18   ` [PATCH v3] devtools: " Jerin Jacob
  1 sibling, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2017-02-27 14:18 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, ferruh.yigit

2017-01-17 14:11, Jerin Jacob:
> 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=)

What is the purpose of selecting a configuration?
Is it to go quicker in the implementation you are interested in?
In that case, I think we need a catch-all option, because I like
being prompted by vim that several implementations exist and I can
choose one of them.

> example usage:
> make tags T=x86_64-native-linuxapp-gcc
> make cscope T=x86_64-native-linuxapp-gcc
> make gtags T=x86_64-native-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>
[...]
>  .gitignore        |   8 ++
>  devtools/tags.sh  | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  mk/rte.sdkroot.mk |   4 +
>  3 files changed, 263 insertions(+)

I think build-tags.sh would be a better name.

On the implementation, I have few comments:
	- is there a way to re-use the skip list when including the related files?
	- you can remove tile from this patch
And for the details:
	- why a bash shebang where /bin/sh would be wider?
	- verbose option should be -v (with getopts)
	- please use $() instead of backquotes
	- please avoid one-line functions used only once like doctags

I can help you with this script if needed.

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

* Re: [PATCH v2] tools: add tags and cscope index file generation support
  2017-02-27 14:18   ` Thomas Monjalon
@ 2017-02-28 14:12     ` Jerin Jacob
  2017-03-01 10:51       ` Thomas Monjalon
  0 siblings, 1 reply; 19+ messages in thread
From: Jerin Jacob @ 2017-02-28 14:12 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, ferruh.yigit

On Mon, Feb 27, 2017 at 03:18:52PM +0100, Thomas Monjalon wrote:
> 2017-01-17 14:11, Jerin Jacob:
> > 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=)
> 
> What is the purpose of selecting a configuration?
> Is it to go quicker in the implementation you are interested in?

Yes. That is the hard part to do.

> In that case, I think we need a catch-all option, because I like
> being prompted by vim that several implementations exist and I can
> choose one of them.

OK. Then we can make T= as optional and if T= is not specified then script can
take all the source files. Thoughts?

> 
> > example usage:
> > make tags T=x86_64-native-linuxapp-gcc
> > make cscope T=x86_64-native-linuxapp-gcc
> > make gtags T=x86_64-native-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>
> [...]
> >  .gitignore        |   8 ++
> >  devtools/tags.sh  | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  mk/rte.sdkroot.mk |   4 +
> >  3 files changed, 263 insertions(+)
> 
> I think build-tags.sh would be a better name.

OK

> 
> On the implementation, I have few comments:
> 	- is there a way to re-use the skip list when including the related files?
> 	- you can remove tile from this patch

OK

> And for the details:
> 	- why a bash shebang where /bin/sh would be wider?

I will change to /bin/sh

> 	- verbose option should be -v (with getopts)

OK

> 	- please use $() instead of backquotes

OK

> 	- please avoid one-line functions used only once like doctags

OK

> 
> I can help you with this script if needed.

OK. I can work on this next week, if you have time then feel free to
take up this.

> 

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

* Re: [PATCH v2] tools: add tags and cscope index file generation support
  2017-02-28 14:12     ` Jerin Jacob
@ 2017-03-01 10:51       ` Thomas Monjalon
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2017-03-01 10:51 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, ferruh.yigit

2017-02-28 19:42, Jerin Jacob:
> On Mon, Feb 27, 2017 at 03:18:52PM +0100, Thomas Monjalon wrote:
> > 2017-01-17 14:11, Jerin Jacob:
> > > 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=)
> > 
> > What is the purpose of selecting a configuration?
> > Is it to go quicker in the implementation you are interested in?
> 
> Yes. That is the hard part to do.
> 
> > In that case, I think we need a catch-all option, because I like
> > being prompted by vim that several implementations exist and I can
> > choose one of them.
> 
> OK. Then we can make T= as optional and if T= is not specified then script can
> take all the source files. Thoughts?

OK

> > I can help you with this script if needed.
> 
> OK. I can work on this next week, if you have time then feel free to
> take up this.

I have no time this week.
But do not hesitate to ping me when doing the v2 if you feel I can help.

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

* [PATCH v3] devtools: add tags and cscope index file generation support
  2017-01-17  8:41 ` [PATCH v2] " Jerin Jacob
  2017-02-27 14:18   ` Thomas Monjalon
@ 2017-03-13 14:18   ` Jerin Jacob
  2017-03-19 10:52     ` [PATCH v4] " Jerin Jacob
  1 sibling, 1 reply; 19+ messages in thread
From: Jerin Jacob @ 2017-03-13 14:18 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, ferruh.yigit, Jerin Jacob

This script generates cscope, gtags, and tags index files based on
EAL environment(architecture and OS(linux/bsd)).

If EAL environment(config) is not specified, the script generates tag
files based on available source code.

Usage: build-tags.sh [-h] [-v] tags|cscope|gtags|etags [config]

example usage:
./devtools/build-tags.sh cscope
./devtools/build-tags.sh tags x86_64-native-linuxapp-gcc
./devtools/build-tags.sh gtags 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>
---

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 | 269 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 278 insertions(+)
 create mode 100755 devtools/build-tags.sh

diff --git a/.gitignore b/.gitignore
index a722abe..7eade38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,10 @@
 doc/guides/nics/overview_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 0000000..d4a8a98
--- /dev/null
+++ b/devtools/build-tags.sh
@@ -0,0 +1,269 @@
+#!/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
+linuxapp=false
+bsdapp=false
+x86_64=false
+arm=false
+arm64=false
+ia_32=false
+ppc_64=false
+
+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="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"
+}
+
+linuxapp_sources()
+{
+	find_sources "lib/librte_eal/linuxapp" '*.[chS]'
+}
+
+bsdapp_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_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+arm64_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					 "$skip_32b_files"
+	find_sources "$source_dirs" '*arm64.[chS]'
+}
+
+ia_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]'
+}
+
+i686_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+x86_64_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_32b_files"
+}
+
+ppc64_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]'
+}
+
+config_file()
+{
+	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
+		ls $RTE_SDK/$RTE_TARGET/include/rte_config.h
+	fi
+}
+
+check_valid_config()
+{
+	cfgfound=false
+	allconfigs=$(make showconfigs)
+	for cfg in $allconfigs
+	do
+		if [ "$cfg" = "$1" ] ; then
+			cfgfound=true
+		fi
+	done
+	$cfgfound || echo "Invalid config: $1"
+	$cfgfound || print_usage
+	$cfgfound || exit 0
+}
+
+if [ -n "$2" ]; then
+	check_valid_config $2
+
+	if [ $(echo $2 | grep -c "linuxapp-") -gt 0 ]; then
+		linuxapp=true
+	fi
+
+	if [ $(echo $2 | grep -c "bsdapp-") -gt 0 ]; then
+		bsdapp=true
+	fi
+
+	if [ $(echo $2 | grep -c "x86_64-") -gt 0  ]; then
+		x86_64=true
+	fi
+
+	if [ $(echo $2 | grep -c "i686-") -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ $(echo $2 | grep -c "x32-") -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ $(echo $2 | grep -c "arm-") -gt 0 ]; then
+		arm=true
+	fi
+
+	if [ $(echo $2 | grep -c "arm64-") -gt 0 ]; then
+		arm64=true
+	fi
+
+	if [ $(echo $2 | grep -c "ppc_64-") -gt 0 ]; then
+		ppc_64=true
+	fi
+
+else
+	linuxapp=true
+	bsdapp=true
+	x86_64=true
+	arm=true
+	arm64=true
+	ia_32=true
+	ppc_64=true
+fi
+
+all_sources()
+{
+	common_sources
+	$linuxapp && linuxapp_sources
+	$bsdapp && bsdapp_sources
+	$x86_64 && x86_64_sources
+	$ia_32 && i686_sources
+	$arm && arm_sources
+	$arm64 && arm64_sources
+	$ppc_64 && ppc64_sources
+	config_file
+}
+
+show_flags()
+{
+	$verbose && echo "mode:     $1"
+	$verbose && echo "config:   $2"
+	$verbose && echo "linuxapp: $linuxapp"
+	$verbose && echo "bsdapp:   $bsdapp"
+	$verbose && echo "ia_32:    $ia_32"
+	$verbose && echo "x86_64:   $x86_64"
+	$verbose && echo "arm:      $arm"
+	$verbose && echo "arm64:    $arm64"
+	$verbose && echo "ppc_64:   $ppc_64"
+	$verbose && echo "target:   $RTE_SDK/$RTE_TARGET"
+}
+
+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
-- 
2.5.5

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

* [PATCH v4] devtools: add tags and cscope index file generation support
  2017-03-13 14:18   ` [PATCH v3] devtools: " Jerin Jacob
@ 2017-03-19 10:52     ` Jerin Jacob
  2017-03-20 10:15       ` Dumitrescu, Cristian
  2017-03-22  8:30       ` [PATCH v5] " Jerin Jacob
  0 siblings, 2 replies; 19+ messages in thread
From: Jerin Jacob @ 2017-03-19 10:52 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, ferruh.yigit, Jerin Jacob

This script generates cscope, gtags, and tags index files based on
EAL environment(architecture and OS(linux/bsd)).

If EAL environment(config) is not specified, the script generates tag
files based on available source code.

Usage: build-tags.sh [-h] [-v] tags|cscope|gtags|etags [config]

example usage:
./devtools/build-tags.sh cscope
./devtools/build-tags.sh tags x86_64-native-linuxapp-gcc
./devtools/build-tags.sh gtags 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>
---
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 | 271 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 280 insertions(+)
 create mode 100755 devtools/build-tags.sh

diff --git a/.gitignore b/.gitignore
index a722abe..7eade38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,10 @@
 doc/guides/nics/overview_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 0000000..ca5317f
--- /dev/null
+++ b/devtools/build-tags.sh
@@ -0,0 +1,271 @@
+#!/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
+linuxapp=false
+bsdapp=false
+x86_64=false
+arm=false
+arm64=false
+ia_32=false
+ppc_64=false
+
+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"
+}
+
+linuxapp_sources()
+{
+	find_sources "lib/librte_eal/linuxapp" '*.[chS]'
+}
+
+bsdapp_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_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+arm64_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					 "$skip_32b_files"
+	find_sources "$source_dirs" '*arm64.[chS]'
+}
+
+ia_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]'
+}
+
+i686_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+x86_64_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_32b_files"
+}
+
+ppc64_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]'
+}
+
+config_file()
+{
+	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
+		ls $RTE_SDK/$RTE_TARGET/include/rte_config.h
+	fi
+}
+
+check_valid_config()
+{
+	cfgfound=false
+	allconfigs=$(make showconfigs)
+	for cfg in $allconfigs
+	do
+		if [ "$cfg" = "$1" ] ; then
+			cfgfound=true
+		fi
+	done
+	$cfgfound || echo "Invalid config: $1"
+	$cfgfound || print_usage
+	$cfgfound || exit 0
+}
+
+if [ -n "$2" ]; then
+	check_valid_config $2
+
+	if [ $(echo $2 | grep -c "linuxapp-") -gt 0 ]; then
+		linuxapp=true
+	fi
+
+	if [ $(echo $2 | grep -c "bsdapp-") -gt 0 ]; then
+		bsdapp=true
+	fi
+
+	if [ $(echo $2 | grep -c "x86_64-") -gt 0  ]; then
+		x86_64=true
+	fi
+
+	if [ $(echo $2 | grep -c "i686-") -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ $(echo $2 | grep -c "x32-") -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ $(echo $2 | grep -c "arm-") -gt 0 ]; then
+		arm=true
+	fi
+
+	if [ $(echo $2 | grep -c "arm64-") -gt 0 ]; then
+		arm64=true
+	fi
+
+	if [ $(echo $2 | grep -c "ppc_64-") -gt 0 ]; then
+		ppc_64=true
+	fi
+
+else
+	linuxapp=true
+	bsdapp=true
+	x86_64=true
+	arm=true
+	arm64=true
+	ia_32=true
+	ppc_64=true
+fi
+
+all_sources()
+{
+	common_sources
+	$linuxapp && linuxapp_sources
+	$bsdapp && bsdapp_sources
+	$x86_64 && x86_64_sources
+	$ia_32 && i686_sources
+	$arm && arm_sources
+	$arm64 && arm64_sources
+	$ppc_64 && ppc64_sources
+	config_file
+}
+
+show_flags()
+{
+	$verbose && echo "mode:     $1"
+	$verbose && echo "config:   $2"
+	$verbose && echo "linuxapp: $linuxapp"
+	$verbose && echo "bsdapp:   $bsdapp"
+	$verbose && echo "ia_32:    $ia_32"
+	$verbose && echo "x86_64:   $x86_64"
+	$verbose && echo "arm:      $arm"
+	$verbose && echo "arm64:    $arm64"
+	$verbose && echo "ppc_64:   $ppc_64"
+	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
+		$verbose && echo "target:   $RTE_SDK/$RTE_TARGET"
+	fi
+}
+
+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
-- 
2.5.5

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

* Re: [PATCH v4] devtools: add tags and cscope index file generation support
  2017-03-19 10:52     ` [PATCH v4] " Jerin Jacob
@ 2017-03-20 10:15       ` Dumitrescu, Cristian
  2017-03-21  4:05         ` Jerin Jacob
  2017-03-22  8:30       ` [PATCH v5] " Jerin Jacob
  1 sibling, 1 reply; 19+ messages in thread
From: Dumitrescu, Cristian @ 2017-03-20 10:15 UTC (permalink / raw)
  To: Jerin Jacob, dev; +Cc: thomas.monjalon, Yigit, Ferruh



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> Sent: Sunday, March 19, 2017 10:52 AM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v4] devtools: add tags and cscope index file
> generation support
> 
> This script generates cscope, gtags, and tags index files based on
> EAL environment(architecture and OS(linux/bsd)).
> 
> If EAL environment(config) is not specified, the script generates tag
> files based on available source code.
> 
> Usage: build-tags.sh [-h] [-v] tags|cscope|gtags|etags [config]
> 
> example usage:
> ./devtools/build-tags.sh cscope
> ./devtools/build-tags.sh tags x86_64-native-linuxapp-gcc
> ./devtools/build-tags.sh gtags arm64-armv8a-linuxapp-gcc
> 

This is great, Jerin, thank you!

IMO it would be even better to have this as one of the targets in the master makefile rather than a standalone script, what do you think?

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

* Re: [PATCH v4] devtools: add tags and cscope index file generation support
  2017-03-20 10:15       ` Dumitrescu, Cristian
@ 2017-03-21  4:05         ` Jerin Jacob
  0 siblings, 0 replies; 19+ messages in thread
From: Jerin Jacob @ 2017-03-21  4:05 UTC (permalink / raw)
  To: Dumitrescu, Cristian; +Cc: dev, thomas.monjalon, Yigit, Ferruh

On Mon, Mar 20, 2017 at 10:15:45AM +0000, Dumitrescu, Cristian wrote:
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> > Sent: Sunday, March 19, 2017 10:52 AM
> > To: dev@dpdk.org
> > Cc: thomas.monjalon@6wind.com; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH v4] devtools: add tags and cscope index file
> > generation support
> > 
> > This script generates cscope, gtags, and tags index files based on
> > EAL environment(architecture and OS(linux/bsd)).
> > 
> > If EAL environment(config) is not specified, the script generates tag
> > files based on available source code.
> > 
> > Usage: build-tags.sh [-h] [-v] tags|cscope|gtags|etags [config]
> > 
> > example usage:
> > ./devtools/build-tags.sh cscope
> > ./devtools/build-tags.sh tags x86_64-native-linuxapp-gcc
> > ./devtools/build-tags.sh gtags arm64-armv8a-linuxapp-gcc
> > 
> 
> This is great, Jerin, thank you!
> 
> IMO it would be even better to have this as one of the targets in the master makefile rather than a standalone script, what do you think?

I had it in v2 and then I removed it.
If there are no objection, I will add these targets in Makefile in next
revision.

Example usage:
make tags T=x86_64-native-linuxapp-gcc
make tags

➜ [master]laptop [dpdk-master] $ git diff
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 7598bde..cee53ff 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -92,6 +92,15 @@ default: all
 config showconfigs showversion showversionum:
        $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@
 
+.PHONY: cscope gtags tags etags
+cscope gtags tags etags:
+ifdef T
+       $(Q)$(RTE_SDK)/devtools/build-tags.sh $@ ${T}
+else
+       $(Q)$(RTE_SDK)/devtools/build-tags.sh $@
+endif
+
+

> 

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

* [PATCH v5] devtools: add tags and cscope index file generation support
  2017-03-19 10:52     ` [PATCH v4] " Jerin Jacob
  2017-03-20 10:15       ` Dumitrescu, Cristian
@ 2017-03-22  8:30       ` Jerin Jacob
  2017-04-14 12:44         ` Jerin Jacob
                           ` (2 more replies)
  1 sibling, 3 replies; 19+ messages in thread
From: Jerin Jacob @ 2017-03-22  8:30 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, Jerin Jacob

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>
---
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 | 271 +++++++++++++++++++++++++++++++++++++++++++++++++
 mk/rte.sdkroot.mk      |   8 ++
 3 files changed, 288 insertions(+)
 create mode 100755 devtools/build-tags.sh

diff --git a/.gitignore b/.gitignore
index a722abe..7eade38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,10 @@
 doc/guides/nics/overview_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 0000000..ca5317f
--- /dev/null
+++ b/devtools/build-tags.sh
@@ -0,0 +1,271 @@
+#!/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
+linuxapp=false
+bsdapp=false
+x86_64=false
+arm=false
+arm64=false
+ia_32=false
+ppc_64=false
+
+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"
+}
+
+linuxapp_sources()
+{
+	find_sources "lib/librte_eal/linuxapp" '*.[chS]'
+}
+
+bsdapp_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_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+arm64_sources()
+{
+	arm_common
+	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
+					 "$skip_32b_files"
+	find_sources "$source_dirs" '*arm64.[chS]'
+}
+
+ia_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]'
+}
+
+i686_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_64b_files"
+}
+
+x86_64_sources()
+{
+	ia_common
+	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
+					"$skip_32b_files"
+}
+
+ppc64_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]'
+}
+
+config_file()
+{
+	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
+		ls $RTE_SDK/$RTE_TARGET/include/rte_config.h
+	fi
+}
+
+check_valid_config()
+{
+	cfgfound=false
+	allconfigs=$(make showconfigs)
+	for cfg in $allconfigs
+	do
+		if [ "$cfg" = "$1" ] ; then
+			cfgfound=true
+		fi
+	done
+	$cfgfound || echo "Invalid config: $1"
+	$cfgfound || print_usage
+	$cfgfound || exit 0
+}
+
+if [ -n "$2" ]; then
+	check_valid_config $2
+
+	if [ $(echo $2 | grep -c "linuxapp-") -gt 0 ]; then
+		linuxapp=true
+	fi
+
+	if [ $(echo $2 | grep -c "bsdapp-") -gt 0 ]; then
+		bsdapp=true
+	fi
+
+	if [ $(echo $2 | grep -c "x86_64-") -gt 0  ]; then
+		x86_64=true
+	fi
+
+	if [ $(echo $2 | grep -c "i686-") -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ $(echo $2 | grep -c "x32-") -gt 0 ]; then
+		ia_32=true
+	fi
+
+	if [ $(echo $2 | grep -c "arm-") -gt 0 ]; then
+		arm=true
+	fi
+
+	if [ $(echo $2 | grep -c "arm64-") -gt 0 ]; then
+		arm64=true
+	fi
+
+	if [ $(echo $2 | grep -c "ppc_64-") -gt 0 ]; then
+		ppc_64=true
+	fi
+
+else
+	linuxapp=true
+	bsdapp=true
+	x86_64=true
+	arm=true
+	arm64=true
+	ia_32=true
+	ppc_64=true
+fi
+
+all_sources()
+{
+	common_sources
+	$linuxapp && linuxapp_sources
+	$bsdapp && bsdapp_sources
+	$x86_64 && x86_64_sources
+	$ia_32 && i686_sources
+	$arm && arm_sources
+	$arm64 && arm64_sources
+	$ppc_64 && ppc64_sources
+	config_file
+}
+
+show_flags()
+{
+	$verbose && echo "mode:     $1"
+	$verbose && echo "config:   $2"
+	$verbose && echo "linuxapp: $linuxapp"
+	$verbose && echo "bsdapp:   $bsdapp"
+	$verbose && echo "ia_32:    $ia_32"
+	$verbose && echo "x86_64:   $x86_64"
+	$verbose && echo "arm:      $arm"
+	$verbose && echo "arm64:    $arm64"
+	$verbose && echo "ppc_64:   $ppc_64"
+	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
+		$verbose && echo "target:   $RTE_SDK/$RTE_TARGET"
+	fi
+}
+
+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 7598bde..6f9bfc5 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -92,6 +92,14 @@ default: all
 config showconfigs showversion showversionum:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@
 
+.PHONY: cscope gtags tags etags
+cscope gtags tags etags:
+ifdef T
+	$(Q)$(RTE_SDK)/devtools/build-tags.sh $@ ${T}
+else
+	$(Q)$(RTE_SDK)/devtools/build-tags.sh $@
+endif
+
 .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.5.5

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

* Re: [PATCH v5] devtools: add tags and cscope index file generation support
  2017-03-22  8:30       ` [PATCH v5] " Jerin Jacob
@ 2017-04-14 12:44         ` Jerin Jacob
  2017-04-28  8:50         ` Thomas Monjalon
  2017-04-29 10:51         ` [PATCH v6] " Jerin Jacob
  2 siblings, 0 replies; 19+ messages in thread
From: Jerin Jacob @ 2017-04-14 12:44 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon

-----Original Message-----
> Date: Wed, 22 Mar 2017 14:00:04 +0530
> From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com, Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v5] devtools: add tags and cscope index file
>  generation support
> X-Mailer: git-send-email 2.5.5
> 
> 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>

Ping.


> ---
> 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 | 271 +++++++++++++++++++++++++++++++++++++++++++++++++
>  mk/rte.sdkroot.mk      |   8 ++
>  3 files changed, 288 insertions(+)
>  create mode 100755 devtools/build-tags.sh
> 
> diff --git a/.gitignore b/.gitignore
> index a722abe..7eade38 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -1 +1,10 @@
>  doc/guides/nics/overview_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 0000000..ca5317f
> --- /dev/null
> +++ b/devtools/build-tags.sh
> @@ -0,0 +1,271 @@
> +#!/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
> +linuxapp=false
> +bsdapp=false
> +x86_64=false
> +arm=false
> +arm64=false
> +ia_32=false
> +ppc_64=false
> +
> +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"
> +}
> +
> +linuxapp_sources()
> +{
> +	find_sources "lib/librte_eal/linuxapp" '*.[chS]'
> +}
> +
> +bsdapp_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_sources()
> +{
> +	arm_common
> +	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
> +					"$skip_64b_files"
> +}
> +
> +arm64_sources()
> +{
> +	arm_common
> +	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
> +					 "$skip_32b_files"
> +	find_sources "$source_dirs" '*arm64.[chS]'
> +}
> +
> +ia_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]'
> +}
> +
> +i686_sources()
> +{
> +	ia_common
> +	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
> +					"$skip_64b_files"
> +}
> +
> +x86_64_sources()
> +{
> +	ia_common
> +	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
> +					"$skip_32b_files"
> +}
> +
> +ppc64_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]'
> +}
> +
> +config_file()
> +{
> +	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
> +		ls $RTE_SDK/$RTE_TARGET/include/rte_config.h
> +	fi
> +}
> +
> +check_valid_config()
> +{
> +	cfgfound=false
> +	allconfigs=$(make showconfigs)
> +	for cfg in $allconfigs
> +	do
> +		if [ "$cfg" = "$1" ] ; then
> +			cfgfound=true
> +		fi
> +	done
> +	$cfgfound || echo "Invalid config: $1"
> +	$cfgfound || print_usage
> +	$cfgfound || exit 0
> +}
> +
> +if [ -n "$2" ]; then
> +	check_valid_config $2
> +
> +	if [ $(echo $2 | grep -c "linuxapp-") -gt 0 ]; then
> +		linuxapp=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "bsdapp-") -gt 0 ]; then
> +		bsdapp=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "x86_64-") -gt 0  ]; then
> +		x86_64=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "i686-") -gt 0 ]; then
> +		ia_32=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "x32-") -gt 0 ]; then
> +		ia_32=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "arm-") -gt 0 ]; then
> +		arm=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "arm64-") -gt 0 ]; then
> +		arm64=true
> +	fi
> +
> +	if [ $(echo $2 | grep -c "ppc_64-") -gt 0 ]; then
> +		ppc_64=true
> +	fi
> +
> +else
> +	linuxapp=true
> +	bsdapp=true
> +	x86_64=true
> +	arm=true
> +	arm64=true
> +	ia_32=true
> +	ppc_64=true
> +fi
> +
> +all_sources()
> +{
> +	common_sources
> +	$linuxapp && linuxapp_sources
> +	$bsdapp && bsdapp_sources
> +	$x86_64 && x86_64_sources
> +	$ia_32 && i686_sources
> +	$arm && arm_sources
> +	$arm64 && arm64_sources
> +	$ppc_64 && ppc64_sources
> +	config_file
> +}
> +
> +show_flags()
> +{
> +	$verbose && echo "mode:     $1"
> +	$verbose && echo "config:   $2"
> +	$verbose && echo "linuxapp: $linuxapp"
> +	$verbose && echo "bsdapp:   $bsdapp"
> +	$verbose && echo "ia_32:    $ia_32"
> +	$verbose && echo "x86_64:   $x86_64"
> +	$verbose && echo "arm:      $arm"
> +	$verbose && echo "arm64:    $arm64"
> +	$verbose && echo "ppc_64:   $ppc_64"
> +	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
> +		$verbose && echo "target:   $RTE_SDK/$RTE_TARGET"
> +	fi
> +}
> +
> +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 7598bde..6f9bfc5 100644
> --- a/mk/rte.sdkroot.mk
> +++ b/mk/rte.sdkroot.mk
> @@ -92,6 +92,14 @@ default: all
>  config showconfigs showversion showversionum:
>  	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@
>  
> +.PHONY: cscope gtags tags etags
> +cscope gtags tags etags:
> +ifdef T
> +	$(Q)$(RTE_SDK)/devtools/build-tags.sh $@ ${T}
> +else
> +	$(Q)$(RTE_SDK)/devtools/build-tags.sh $@
> +endif
> +
>  .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.5.5
> 

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

* Re: [PATCH v5] devtools: add tags and cscope index file generation support
  2017-03-22  8:30       ` [PATCH v5] " Jerin Jacob
  2017-04-14 12:44         ` Jerin Jacob
@ 2017-04-28  8:50         ` Thomas Monjalon
  2017-04-29 10:51         ` [PATCH v6] " Jerin Jacob
  2 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2017-04-28  8:50 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev

Hi,
I have some comments about behaviour, naming and coding style.

22/03/2017 09:30, Jerin Jacob:
> +verbose=false
> +linuxapp=false
> +bsdapp=false

linuxapp/bsdapp could be renamed to simpler linux/bsd.

> +x86_64=false
> +arm=false

Why not arm32 for consistency?

> +arm64=false
> +ia_32=false

ia_32 should be x86_32

> +ppc_64=false

[...]
> +	make showconfigs | sed 's,^,\t,'

This is assuming the working dir is the dpdk root.
It is assumed elsewhere in the script.
I suggest adding "cd $(dirname $0)/.." at the beginning of the script.

[...]
> +arm_common()
> +{
> +	find_sources "lib/librte_eal/common/arch/arm" '*.[chS]'
> +	find_sources "$source_dirs" '*neon*.[chS]'
> +}
> +
> +arm_sources()
> +{
> +	arm_common
> +	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
> +					"$skip_64b_files"
> +}
> +
> +arm64_sources()
> +{
> +	arm_common
> +	find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
> +					 "$skip_32b_files"
> +	find_sources "$source_dirs" '*arm64.[chS]'
> +}

Same comment about arm32 consistency.

> +ia_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]'
> +}
> +
> +i686_sources()
> +{
> +	ia_common
> +	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
> +					"$skip_64b_files"
> +}
> +
> +x86_64_sources()
> +{
> +	ia_common
> +	find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
> +					"$skip_32b_files"
> +}

... and here x86/x86_32 instead of ia/i686


> +config_file()
> +{
> +	if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
> +		ls $RTE_SDK/$RTE_TARGET/include/rte_config.h
> +	fi
> +}

RTE_TARGET is used to define the build directory.
It will not be defined in this script and it does not really
make sense to enforce it.
I suggest to remove rte_config.h from this script.
Other argument: you can have several build directories
with different configs.

[...]
> +check_valid_config()

It is not a config but a target.
Yes the target is checked against existing config template names.

> +{
> +	cfgfound=false
> +	allconfigs=$(make showconfigs)
> +	for cfg in $allconfigs
> +	do

This "do" keyword could be on the previous line, like you did for if...then.

> +		if [ "$cfg" = "$1" ] ; then
> +			cfgfound=true
> +		fi
> +	done
> +	$cfgfound || echo "Invalid config: $1"
> +	$cfgfound || print_usage
> +	$cfgfound || exit 0

Better to use an "if" block here.

[...]
> +	if [ $(echo $2 | grep -c "linuxapp-") -gt 0 ]; then
> +		linuxapp=true
> +	fi

More compact grep:
	if echo $2 | grep -q "linuxapp-" ; then

[...]
> +else
> +	linuxapp=true
> +	bsdapp=true
> +	x86_64=true
> +	arm=true
> +	arm64=true
> +	ia_32=true
> +	ppc_64=true
> +fi

You could define them as true by default.
So the above grep would become:
	echo $2 | grep -q "linuxapp-" || linux=false

[...]
> +all_sources()
> +{
> +	common_sources
> +	$linuxapp && linuxapp_sources
> +	$bsdapp && bsdapp_sources
> +	$x86_64 && x86_64_sources
> +	$ia_32 && i686_sources
> +	$arm && arm_sources
> +	$arm64 && arm64_sources
> +	$ppc_64 && ppc64_sources

I am a bit surprised by these constructs.
When using sh -e, we should not have a false statement.
I think it should be:
	if $linuxapp ; then linuxapp_sources ; fi

[...]
> +show_flags()
> +{
> +	$verbose && echo "mode:     $1"
> +	$verbose && echo "config:   $2"
> +	$verbose && echo "linuxapp: $linuxapp"
> +	$verbose && echo "bsdapp:   $bsdapp"
> +	$verbose && echo "ia_32:    $ia_32"
> +	$verbose && echo "x86_64:   $x86_64"
> +	$verbose && echo "arm:      $arm"
> +	$verbose && echo "arm64:    $arm64"
> +	$verbose && echo "ppc_64:   $ppc_64"

Please use an "if" block here.

> +++ b/mk/rte.sdkroot.mk
> +.PHONY: cscope gtags tags etags
> +cscope gtags tags etags:
> +ifdef T
> +	$(Q)$(RTE_SDK)/devtools/build-tags.sh $@ ${T}
> +else
> +	$(Q)$(RTE_SDK)/devtools/build-tags.sh $@
> +endif

No need of ifdef.

Thanks Jerin

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

* [PATCH v6] devtools: add tags and cscope index file generation support
  2017-03-22  8:30       ` [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
  2017-04-30 10:45           ` Thomas Monjalon
  2 siblings, 1 reply; 19+ messages in thread
From: Jerin Jacob @ 2017-04-29 10:51 UTC (permalink / raw)
  To: dev; +Cc: thomas, ferruh.yigit, Jerin Jacob

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

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

* Re: [PATCH v6] devtools: add tags and cscope index file generation support
  2017-04-29 10:51         ` [PATCH v6] " Jerin Jacob
@ 2017-04-30 10:45           ` Thomas Monjalon
  2017-04-30 11:00             ` Thomas Monjalon
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2017-04-30 10:45 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, ferruh.yigit

29/04/2017 12:51, Jerin Jacob:
> 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

Reviewed-by: Thomas Monjalon <thomas@monjalon.net>

Applied, thanks

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

* Re: [PATCH v6] devtools: add tags and cscope index file generation support
  2017-04-30 10:45           ` Thomas Monjalon
@ 2017-04-30 11:00             ` Thomas Monjalon
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2017-04-30 11:00 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, ferruh.yigit

30/04/2017 12:45, Thomas Monjalon:
> 29/04/2017 12:51, Jerin Jacob:
> > 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
> 
> Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Applied, thanks

PS: I've just moved the "cd" line at the beginning of the script
in order to be able to do:
	devtools % ./build-tags.sh -h

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

end of thread, other threads:[~2017-04-30 11:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-27  0:12 [PATCH] tools: add tags and cscope index file generation support 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 ` [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   ` [PATCH v3] devtools: " Jerin Jacob
2017-03-19 10:52     ` [PATCH v4] " Jerin Jacob
2017-03-20 10:15       ` Dumitrescu, Cristian
2017-03-21  4:05         ` Jerin Jacob
2017-03-22  8:30       ` [PATCH v5] " Jerin Jacob
2017-04-14 12:44         ` Jerin Jacob
2017-04-28  8:50         ` Thomas Monjalon
2017-04-29 10:51         ` [PATCH v6] " Jerin Jacob
2017-04-30 10:45           ` Thomas Monjalon
2017-04-30 11:00             ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.