| 1 | #! /bin/bash |
| 2 | |
| 3 | # Copyright (c) 2002, 2026, Oracle and/or its affiliates. |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License, version 2.0, |
| 7 | # as published by the Free Software Foundation. |
| 8 | # |
| 9 | # This program is designed to work with certain software (including |
| 10 | # but not limited to OpenSSL) that is licensed under separate terms, |
| 11 | # as designated in a particular file or component or in included license |
| 12 | # documentation. The authors of MySQL hereby grant you an additional |
| 13 | # permission to link the program and your derivative works with the |
| 14 | # separately licensed software that they have either included with |
| 15 | # the program or referenced in the documentation. |
| 16 | # |
| 17 | # This program is distributed in the hope that it will be useful, |
| 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | # GNU General Public License, version 2.0, for more details. |
| 21 | # |
| 22 | # You should have received a copy of the GNU General Public License |
| 23 | # along with this program; if not, write to the Free Software |
| 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 | |
| 26 | tagstyle=${1:-etags} |
| 27 | |
| 28 | common_opts="--langmap=C++:+.ic,YACC:+.yy -I MY_ATTRIBUTE+" |
| 29 | case $tagstyle in |
| 30 | "etags") tagfile=TAGS |
| 31 | tagopt="-e $common_opts" |
| 32 | ;; |
| 33 | "ctags") tagfile=tags |
| 34 | tagopt="--fields=+l $common_opts" |
| 35 | ;; |
| 36 | *) echo "$0 [etags|ctags]" |
| 37 | exit 1 |
| 38 | ;; |
| 39 | esac |
| 40 | |
| 41 | rm -f $tagfile |
| 42 | filter='\.cpp$\|\.cc$\|\.c$\|\.h$\|sql_yacc\.yy$\|\.hpp$\|\.ic$' |
| 43 | |
| 44 | list="find . -type f" |
| 45 | git rev-parse >/dev/null 2>/dev/null && list="git ls-files" |
| 46 | |
| 47 | ctags $tagopt -o $tagfile $( $list | grep $filter ) |
| 48 | |
| 49 | echo "wrote file `pwd`/$tagfile" |