| 1 |
/* |
| 2 |
* fstrcmp - fuzzy string compare library |
| 3 |
* Copyright (C) 2009 Peter Miller |
| 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 as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
if [find_command ctags] then |
| 20 |
{ |
| 21 |
/* |
| 22 |
* There are three different versions of these commands, |
| 23 |
* and they take completely different command line options. We |
| 24 |
* assume minimal posix syntax if nothing better is available. |
| 25 |
* (What were they thinking? Were they even thinking?) |
| 26 |
*/ |
| 27 |
ctags-variant = posix; |
| 28 |
|
| 29 |
ctags = ctags; |
| 30 |
ctags-opts = ; |
| 31 |
etags = ctags; |
| 32 |
etags-opts = ; |
| 33 |
|
| 34 |
/* |
| 35 |
* The '|| true' is needed because if ctags fails the build stops. |
| 36 |
*/ |
| 37 |
ctags-version = [collect ctags --version 2>/dev/null || true]; |
| 38 |
if [in Exuberant [ctags-version]] then |
| 39 |
{ |
| 40 |
ctags-variant = exuberant; |
| 41 |
} |
| 42 |
else |
| 43 |
if [in Emacs [ctags-version]] then |
| 44 |
{ |
| 45 |
ctags-variant = emacs; |
| 46 |
} |
| 47 |
|
| 48 |
all += tags; |
| 49 |
|
| 50 |
if [find_command etags] then |
| 51 |
{ |
| 52 |
etags = etags; |
| 53 |
all += TAGS; |
| 54 |
} |
| 55 |
|
| 56 |
/* |
| 57 |
* xargs can invoke ctags/etags more than once if the underling |
| 58 |
* shell does not handle so much arguments. In order to not |
| 59 |
* truncate the target the '-a' options must be used. It is posix |
| 60 |
* compliant and should be supported by different ctags variant. |
| 61 |
*/ |
| 62 |
ctags-opts = -a; |
| 63 |
|
| 64 |
if [in posix [ctags-variant]] then |
| 65 |
ctags-opts += -f; |
| 66 |
|
| 67 |
if [in exuberant [ctags-variant]] then |
| 68 |
{ |
| 69 |
ctags-opts += --c-types\=+px -f; |
| 70 |
etags = ctags -e; |
| 71 |
all += TAGS; |
| 72 |
} |
| 73 |
|
| 74 |
/* |
| 75 |
* The (GNU) Emacs variant of ctags (based an Exuberant) use -o |
| 76 |
* to set the output file name. |
| 77 |
*/ |
| 78 |
if [in emacs [ctags-variant]] then |
| 79 |
{ |
| 80 |
etags-opts = [ctags-opts] |
| 81 |
--declarations -o ; |
| 82 |
ctags-opts += --declarations --defines --globals --members --typedefs |
| 83 |
--no-warn /* (--no-warn option only works for ctags) */ |
| 84 |
-o |
| 85 |
; |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
tags: [change_files] |
| 90 |
set shallow no-cascade |
| 91 |
{ |
| 92 |
xargs ctags [ctags-opts] [target] |
| 93 |
set meter; |
| 94 |
data |
| 95 |
[unsplit "\n" [resolve [source_files]]] |
| 96 |
dataend |
| 97 |
} |
| 98 |
|
| 99 |
TAGS: [change_files] |
| 100 |
set shallow no-cascade |
| 101 |
{ |
| 102 |
xargs [etags] [etags-opts] [target] |
| 103 |
set meter; |
| 104 |
data |
| 105 |
[unsplit "\n" [resolve [source_files]]] |
| 106 |
dataend |
| 107 |
} |