3 # src/tools/make_ctags [-e] [-n]
4 # If -e is specified, generate tags files for emacs.
5 # If -n is specified, don't create symbolic links of tags file.
6 usage
="Usage: $0 [-e][-n]"
34 if [ ! "$EMACS_MODE" ]
35 then (command -v ctags
>/dev
/null
) || \
36 { echo "'ctags' program not found" 1>&2; exit 1; }
39 ctags
--version 2>&1 |
grep Exuberant
&& IS_EXUBERANT
="Y"
43 if [ "$IS_EXUBERANT" ]
45 else (command -v etags
>/dev
/null
) || \
46 { echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; exit 1; }
52 # List of kinds supported by Exuberant Ctags 5.8
53 # generated by ctags --list-kinds
54 # --c-kinds was called --c-types before 2003
57 # e enumerators (values inside an enumeration)
58 # f function definitions
60 # l local variables [off]
61 # m class, struct, and union members
63 # p function prototypes [off]
67 # v variable definitions
68 # x external and forward variable declarations [off]
70 if [ "$IS_EXUBERANT" ]
71 then FLAGS
="--c-kinds=+dfmstuv"
72 elif [ ! "$EMACS_MODE" ]
76 # Use -I option to ignore a macro
77 if [ "$IS_EXUBERANT" ]
78 then IGNORE_IDENTIFIES
="-I pg_node_attr+"
81 trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
84 # this is outputting the tags into the file 'tags', and appending
85 find `pwd`/ \
( -name tmp_install
-prune -o -name tmp_check
-prune \
) \
86 -o \
( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*.in" \
87 -o -name "*.sql" -o -name "*.p[lm]" \
) -type f
-print |
88 xargs $PROG $TAGS_OPT $TAGS_FILE $FLAGS $IGNORE_IDENTIFIES
90 # Sorting non-Exuberant ctags file allows for fast searching of the tags file.
91 # Since etags file has a header that we cannot sort in with the other entries
92 # we skip the sort step.
93 if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ]
96 sort $TAGS_FILE >/tmp
/$$
&& mv /tmp
/$$
$TAGS_FILE
99 # create symbolic links
100 if [ ! "$NO_SYMLINK" ]
101 then find . \
( -name 'CVS' -prune \
) -o \
( -name .git
-prune \
) -o -type d
-print |
103 do [ "$DIR" != "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/$TAGS_FILE "$DIR"/$TAGS_FILE