2 # Generate tags or gtags or cscope or etags files
6 # Copyright 2017 Cavium Networks
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # * Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in
16 # the documentation and/or other materials provided with the
18 # * Neither the name of Cavium networks nor the names of its
19 # contributors may be used to endorse or promote products derived
20 # from this software without specific prior written permission.
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 echo "Usage: $(basename $0) [-h] [-v] tags|cscope|gtags|etags [config]"
46 echo "Valid configs are:"
47 make showconfigs | sed 's,^,\t,'
50 # Move to the root of the git tree
53 while getopts hv ARG ; do
56 h ) print_usage; exit 0 ;;
57 ? ) print_usage; exit 1 ;;
60 shift $(($OPTIND - 1))
62 #ignore version control files
63 ignore="( -name .svn -o -name CVS -o -name .hg -o -name .git ) -prune -o"
65 source_dirs="test app buildtools drivers examples lib"
67 skip_bsd="( -name bsdapp ) -prune -o"
68 skip_linux="( -name linuxapp ) -prune -o"
69 skip_arch="( -name arch ) -prune -o"
70 skip_sse="( -name *_sse*.[chS] ) -prune -o"
71 skip_avx="( -name *_avx*.[chS] ) -prune -o"
72 skip_neon="( -name *_neon*.[chS] ) -prune -o"
73 skip_altivec="( -name *_altivec*.[chS] ) -prune -o"
74 skip_arm64="( -name *arm64*.[chS] ) -prune -o"
75 skip_x86="( -name *x86*.[chS] ) -prune -o"
76 skip_32b_files="( -name *_32.h ) -prune -o"
77 skip_64b_files="( -name *_64.h ) -prune -o"
79 skiplist="$skip_bsd $skip_linux $skip_arch $skip_sse $skip_avx \
80 $skip_neon $skip_altivec $skip_x86 $skip_arm64"
84 find $1 $ignore $3 -name $2 -not -type l -print
89 find_sources "$source_dirs" '*.[chS]' "$skiplist"
94 find_sources "lib/librte_eal/linuxapp" '*.[chS]'
99 find_sources "lib/librte_eal/bsdapp" '*.[chS]'
104 find_sources "lib/librte_eal/common/arch/arm" '*.[chS]'
105 find_sources "$source_dirs" '*neon*.[chS]'
111 find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
118 find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
120 find_sources "$source_dirs" '*arm64.[chS]'
125 find_sources "lib/librte_eal/common/arch/x86" '*.[chS]'
127 find_sources "examples/performance-thread/common/arch/x86" '*.[chS]'
128 find_sources "$source_dirs" '*_sse*.[chS]'
129 find_sources "$source_dirs" '*_avx*.[chS]'
130 find_sources "$source_dirs" '*x86.[chS]'
136 find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
143 find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
149 find_sources "lib/librte_eal/common/arch/ppc_64" '*.[chS]'
150 find_sources "lib/librte_eal/common/include/arch/ppc_64" '*.[chS]'
151 find_sources "$source_dirs" '*altivec*.[chS]'
157 allconfigs=$(make showconfigs)
158 for cfg in $allconfigs ; do
159 if [ "$cfg" = "$1" ] ; then
163 if ! $cfgfound ; then
164 echo "Invalid config: $1"
171 check_valid_target $2
173 echo $2 | grep -q "linuxapp-" || linux=false
174 echo $2 | grep -q "bsdapp-" || bsd=false
175 echo $2 | grep -q "x86_64-" || x86_64=false
176 echo $2 | grep -q "arm-" || arm_32=false
177 echo $2 | grep -q "arm64-" || arm_64=false
178 echo $2 | grep -q "ppc_64-" || ppc_64=false
179 echo $2 | grep -q -e "i686-" -e "x32-" || x86_32=false
185 if $linux ; then linux_sources ; fi
186 if $bsd ; then bsd_sources ; fi
187 if $x86_64 ; then x86_64_sources ; fi
188 if $x86_32 ; then x86_32_sources ; fi
189 if $ppc_64 ; then ppc_64_sources ; fi
190 if $arm_32 ; then arm_32_sources ; fi
191 if $arm_64 ; then arm_64_sources ; fi
201 echo "x86_32: $x86_32"
202 echo "x86_64: $x86_64"
203 echo "ppc_64: $ppc_64"
204 echo "arm_32: $arm_32"
205 echo "arm_64: $arm_64"
212 all_sources > cscope.files
213 cscope -q -b -f cscope.out
217 all_sources | gtags -i -f -
222 all_sources | xargs ctags -a
227 all_sources | xargs etags -a
230 echo "Invalid mode: $1"