2 # Generate tags or cscope files
5 # mode may be any of: tags, TAGS, cscope
7 # Uses the following environment variables:
8 # ARCH, SUBARCH, srctree, src, obj
10 if [ "$KBUILD_VERBOSE" = "1" ]; then
14 # This is a duplicate of RCS_FIND_IGNORE without escaped '()'
15 ignore
="( -name SCCS -o -name BitKeeper -o -name .svn -o \
16 -name CVS -o -name .pc -o -name .hg -o \
20 # Do not use full path is we do not use O=.. builds
21 if [ "${KBUILD_SRC}" = "" ]; then
27 # find sources in arch/$ARCH
30 find ${tree}arch
/$1 $ignore -name "$2" -print;
33 # find sources in arch/$1/include
34 find_arch_include_sources
()
36 find ${tree}arch
/$1/include
$ignore -name "$2" -print;
39 # find sources in include/
40 find_include_sources
()
42 find ${tree}include
$ignore -name config
-prune -o -name "$1" -print;
45 # find sources in rest of tree
46 # we could benefit from a list of dirs to search in here
49 find ${tree}* $ignore \
50 \
( -name include
-o -name arch
-o -name '.tmp_*' \
) -prune -o \
56 find_arch_sources
$1 "$2"
57 find_include_sources
"$2"
58 find_other_sources
"$2"
63 find_sources
$SRCARCH '*.[chS]'
64 if [ ! -z "$archinclude" ]; then
65 find_arch_include_sources
$archinclude '*.[chS]'
71 find_sources
$SRCARCH 'Kconfig*'
76 find_sources
$SRCARCH "defconfig"
81 (echo \
-k; echo \
-q; all_sources
) > cscope.files
82 cscope
-b -f cscope.out
88 all_sources |
xargs $1 -a \
89 -I __initdata
,__exitdata
,__acquires
,__releases \
90 -I __read_mostly
,____cacheline_aligned \
91 -I ____cacheline_aligned_in_smp \
92 -I ____cacheline_internodealigned_in_smp \
93 -I EXPORT_SYMBOL
,EXPORT_SYMBOL_GPL \
94 --extra=+f
--c-kinds=+px \
95 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'
97 all_kconfigs |
xargs $1 -a \
98 --langdef=kconfig
--language-force=kconfig \
99 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'
101 all_kconfigs |
xargs $1 -a \
102 --langdef=kconfig
--language-force=kconfig \
103 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
105 all_defconfigs |
xargs -r $1 -a \
106 --langdef=dotconfig
--language-force=dotconfig \
107 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
113 all_sources |
xargs $1 -a
115 all_kconfigs |
xargs $1 -a \
116 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
118 all_kconfigs |
xargs $1 -a \
119 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
121 all_defconfigs |
xargs -r $1 -a \
122 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
127 if $1 --version 2>&1 |
grep -iq exuberant
; then
129 elif $1 --version 2>&1 |
grep -iq emacs
; then
132 all_sources |
xargs $1 -a
137 # Support um (which uses SUBARCH)
138 if [ "${ARCH}" = "um" ]; then
139 if [ "$SUBARCH" = "i386" ]; then
141 elif [ "$SUBARCH" = "x86_64" ]; then
144 archinclude
=${SUBARCH}