2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright(c) 2017 Cavium, Inc
7 # Generate tags or gtags or cscope or etags files
21 echo "Usage: $(basename $0) [-h] [-v] tags|cscope|gtags|etags [config]"
22 echo "Examples of valid configs are: "
23 echo "x86_64-bsd, arm64-linux, ppc_64-linux"
26 # Move to the root of the git tree
29 while getopts hv ARG ; do
32 h ) print_usage; exit 0 ;;
33 ? ) print_usage; exit 1 ;;
36 shift $(($OPTIND - 1))
38 #ignore version control files
39 ignore="( -name .svn -o -name CVS -o -name .hg -o -name .git ) -prune -o"
41 source_dirs="app buildtools drivers examples lib"
43 skip_bsd="( -name freebsd ) -prune -o"
44 skip_linux="( -name linux ) -prune -o"
45 skip_arch="( -name arch ) -prune -o"
46 skip_sse="( -name *_sse*.[chS] ) -prune -o"
47 skip_avx="( -name *_avx*.[chS] ) -prune -o"
48 skip_neon="( -name *_neon*.[chS] ) -prune -o"
49 skip_altivec="( -name *_altivec*.[chS] ) -prune -o"
50 skip_arm64="( -name *arm64*.[chS] ) -prune -o"
51 skip_x86="( -name *x86*.[chS] ) -prune -o"
52 skip_32b_files="( -name *_32.h ) -prune -o"
53 skip_64b_files="( -name *_64.h ) -prune -o"
55 skiplist="$skip_bsd $skip_linux $skip_arch $skip_sse $skip_avx \
56 $skip_neon $skip_altivec $skip_x86 $skip_arm64"
60 find $1 $ignore $3 -name $2 -not -type l -print
65 find_sources "$source_dirs" '*.[chS]' "$skiplist"
70 find_sources "lib/librte_eal/linux" '*.[chS]'
71 find_sources "kernel/linux" '*.[chS]'
76 find_sources "lib/librte_eal/freebsd" '*.[chS]'
77 find_sources "kernel/freebsd" '*.[chS]'
82 find_sources "$source_dirs" '*neon*.[chS]'
88 find_sources "lib/librte_eal/arm" '*.[chS]' \
95 find_sources "lib/librte_eal/arm" '*.[chS]' \
97 find_sources "$source_dirs" '*arm64.[chS]'
102 find_sources "examples/performance-thread/common/arch/x86" '*.[chS]'
103 find_sources "$source_dirs" '*_sse*.[chS]'
104 find_sources "$source_dirs" '*_avx*.[chS]'
105 find_sources "$source_dirs" '*x86.[chS]'
111 find_sources "lib/librte_eal/x86" '*.[chS]' \
118 find_sources "lib/librte_eal/x86" '*.[chS]' \
124 find_sources "lib/librte_eal/ppc" '*.[chS]'
125 find_sources "$source_dirs" '*altivec*.[chS]'
129 echo $2 | grep -q "linux" || linux=false
130 echo $2 | grep -q "bsd" || bsd=false
131 echo $2 | grep -q "x86_64-" || x86_64=false
132 echo $2 | grep -q "arm-" || arm_32=false
133 echo $2 | grep -q "arm64-" || arm_64=false
134 echo $2 | grep -q "ppc_64-" || ppc_64=false
135 echo $2 | grep -q -e "i686-" -e "x32-" || x86_32=false
141 if $linux ; then linux_sources ; fi
142 if $bsd ; then bsd_sources ; fi
143 if $x86_64 ; then x86_64_sources ; fi
144 if $x86_32 ; then x86_32_sources ; fi
145 if $ppc_64 ; then ppc_64_sources ; fi
146 if $arm_32 ; then arm_32_sources ; fi
147 if $arm_64 ; then arm_64_sources ; fi
157 echo "x86_32: $x86_32"
158 echo "x86_64: $x86_64"
159 echo "ppc_64: $ppc_64"
160 echo "arm_32: $arm_32"
161 echo "arm_64: $arm_64"
168 all_sources > cscope.files
169 cscope -q -b -f cscope.out
173 all_sources | gtags -i -f -
178 all_sources | xargs ctags -a
183 all_sources | xargs etags -a
186 echo "Invalid mode: $1"