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 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH
28 if [ "${ALLSOURCE_ARCHS}" = "" ]; then
29 ALLSOURCE_ARCHS
=${SRCARCH}
32 # find sources in arch/$ARCH
35 find ${tree}arch
/$1 $ignore -name "$2" -print;
38 # find sources in arch/$1/include
39 find_arch_include_sources
()
41 find ${tree}arch
/$1/include
$ignore -name "$2" -print;
44 # find sources in include/
45 find_include_sources
()
47 find ${tree}include
$ignore -name config
-prune -o -name "$1" -print;
50 # find sources in rest of tree
51 # we could benefit from a list of dirs to search in here
54 find ${tree}* $ignore \
55 \
( -name include
-o -name arch
-o -name '.tmp_*' \
) -prune -o \
61 find_arch_sources
$1 "$2"
66 for arch
in $ALLSOURCE_ARCHS
68 find_sources
$arch '*.[chS]'
70 if [ ! -z "$archinclude" ]; then
71 find_arch_include_sources
$archinclude '*.[chS]'
73 find_include_sources
'*.[chS]'
74 find_other_sources
'*.[chS]'
79 for arch
in $ALLSOURCE_ARCHS; do
80 find_sources
$arch 'Kconfig*'
82 find_other_sources
'Kconfig*'
87 find_sources
$ALLSOURCE_ARCHS "defconfig"
92 (echo \
-k; echo \
-q; all_sources
) > cscope.files
93 cscope
-b -f cscope.out
98 all_sources |
xargs $1 -a \
99 -I __initdata
,__exitdata
,__acquires
,__releases \
100 -I __read_mostly
,____cacheline_aligned \
101 -I ____cacheline_aligned_in_smp \
102 -I ____cacheline_internodealigned_in_smp \
103 -I EXPORT_SYMBOL
,EXPORT_SYMBOL_GPL \
104 --extra=+f
--c-kinds=+px \
105 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \
106 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/'
108 all_kconfigs |
xargs $1 -a \
109 --langdef=kconfig
--language-force=kconfig \
110 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'
112 all_kconfigs |
xargs $1 -a \
113 --langdef=kconfig
--language-force=kconfig \
114 --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
116 all_defconfigs |
xargs -r $1 -a \
117 --langdef=dotconfig
--language-force=dotconfig \
118 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
124 all_sources |
xargs $1 -a \
125 --regex='/^ENTRY(\([^)]*\)).*/\1/' \
126 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'
128 all_kconfigs |
xargs $1 -a \
129 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
131 all_kconfigs |
xargs $1 -a \
132 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
134 all_defconfigs |
xargs -r $1 -a \
135 --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
140 if $1 --version 2>&1 |
grep -iq exuberant
; then
142 elif $1 --version 2>&1 |
grep -iq emacs
; then
145 all_sources |
xargs $1 -a
150 # Support um (which uses SUBARCH)
151 if [ "${ARCH}" = "um" ]; then
152 if [ "$SUBARCH" = "i386" ]; then
154 elif [ "$SUBARCH" = "x86_64" ]; then
157 archinclude
=${SUBARCH}