1GTAGS(1) General Commands Manual GTAGS(1)
2
3
4
6 gtags - create tag files for global
7
9 gtags [-ciIOqvw][-d tag-file][-f file][dbpath]
10
12 Gtags is used to create tag files for global(1).
13
14 Gtags recursively collects source files under the current directory,
15 picks up symbols and writes the cross-reference data into the tag files
16 (´GTAGS´, ´GRTAGS´ and ´GPATH´).
17
18 If ´gtags.files´ exists in the current directory or a file is specified
19 by the -f option, target files are limited by it. Lines starting with
20 ´. ´ are comments.
21
22 C, yacc, Assembly, Java, C++ and PHP source files are supported. Files
23 whose names end in ´.c´, ´.h´ are assumed to be C source files. Files
24 whose names end in ´.y´ are assumed to be yacc source files. Files
25 whose names end in ´.s´, ´.S´ are assumed to be Assembly source files.
26 Files whose names end in ´.java´ are assumed to be Java source files.
27 Files whose names end in ´.c++´, ´.cc´, ´.hh´, ´.cpp´, ´.cxx´, ´.hxx´,
28 ´.hpp´, ´.C´, ´.H´ are assumed to be C++ source files. Files whose
29 names end in ´.php´, ´.php3´, ´.phtml´ are assumed to be PHP source
30 files. Other files are assumed to be text files. Gtags does not treat
31 binary files.
32
34 The following options are available:
35
36 --accept-dotfiles
37 Accept files and directories whose names begin with a dot. By
38 default, gtags ignores them.
39
40 -c, --compact
41 Make ´GTAGS´ in compact format. This option does not influence
42 ´GRTAGS´, because that is always made in compact format.
43
44 --config[=name]
45 Print the value of config variable name. If name is not speci‐
46 fied then print all names and values. In addition to the vari‐
47 ables listed in the ENVIRONMENT section, you can refer to
48 install directories by read only variables: bindir, libdir,
49 datadir, localstatedir and sysconfdir.
50
51 -d, --dump tag-file
52 Dump a tag file as text to the standard output. Output format is
53
54 --explain
55 Explain handling files.
56
57 -f, --file file
58 Give a list of candidates of target files. Files which are not
59 on the list are ignored. The argument file can be set to ´-´ to
60 accept a list of files from the standard input. File names must
61 be separated by newline. To make the list you may use find(1),
62 which has rich options for selecting files.
63
64 --gtagsconf file
65 Set environment variable GTAGSCONF to file.
66
67 --gtagslabel label
68 Set environment variable GTAGSLABEL to label.
69
70 -I, --idutils
71 In addition to tag files, make ID database for idutils(1).
72
73 -i, --incremental
74 Update tag files incrementally. It's better to use global(1)
75 with the -u command.
76
77 -O, --objdir
78 Use BSD-style obj directory as the location of tag files. If
79 GTAGSOBJDIRPREFIX is set and ´$GTAGSOBJDIRPREFIX´ directory
80 exists, gtags creates ´$GTAGSOBJDIRPREFIX/<current directory>´
81 directory and makes tag files in it. Though you can use MAKEOB‐
82 JDIRPREFIX instead of GTAGSOBJDIRPREFIX, it is deprecated. If
83 dbpath is specified, this option is ignored.
84
85 --single-update file
86 Update tag files for a single file. It is considered that file
87 was added, updated or deleted, and there is no change in other
88 files. This option implies the -i option.
89
90 --skip-unreadable
91 Skip unreadable files.
92
93 --skip-symlink [=type]
94 Skip symbolic links. If type is 'f' then skip only symbolic
95 links for file, else if 'd' then skip only symbolic links for
96 directory. The default value of type is 'a' (all symbolic
97 links).
98
99 --sqlite3
100 Use Sqlite 3 API to make tag files. By default, BSD/DB 1.85 API
101 is used. To use this option, you need to invoke configure
102 script with --with-sqlite3 in the build phase.
103
104 --statistics
105 Print statistics information.
106
107 -q, --quiet
108 Quiet mode.
109
110 -v, --verbose
111 Verbose mode.
112
113 -w, --warning
114 Print warning messages.
115
116 dbpath The directory in which tag files are generated. The default is
117 the current directory.
118
120 $ ls -F
121 Makefile src/ lib/
122 $ gtags -v
123 $ global -x main
124 main 10 src/main.c main (argc, argv) {
125
127 ´GTAGS´
128 Tag file for definitions.
129
130 ´GRTAGS´
131 Tag file for references.
132
133 ´GPATH´
134 Tag file for source files.
135
136 ´gtags.conf´, ´$HOME/.globalrc´
137 Configuration data for GNU GLOBAL. See gtags.conf(5).
138
139 ´gtags.files´
140 The list of candidates of target files.
141
142 ´.notfunction´
143 The list of symbols which is not a definition. If this file
144 exists in the project root directory, gtags does not regard the
145 symbols listed in this file as definitions.
146
148 The following environment variables affect the execution of gtags:
149
150 GTAGSCACHE
151 The size of the B-tree cache. The default is 50000000 (bytes).
152
153 GTAGSCONF
154 Configuration file.
155
156 GTAGSFORCECPP
157 If this variable is set, each file whose suffix is ´.h´ is
158 treated as a C++ source file.
159
160 GTAGSFORCEENDBLOCK
161 If this variable is set, each } at the first column brings end
162 of block of 0 level.
163
164 GTAGSLABEL
165 Configuration label. The default is ´default´.
166
167 GTAGSLOGGING
168 If this variable is set, ´$GTAGSLOGGING´ is used as the path
169 name of a log file. There is no default value.
170
171 GTAGS_COMMANDLINE
172 This variable can only be referenced from the hook (see
173 gtags_hook). Gtags sets its own effective command line to this
174 variable before calling the hook. Each argument is separated by
175 whitespace, and real whitespace is represented as '%20'. This is
176 read only.
177
178 GTAGS_OPTIONS
179 The value of this variable is inserted in the head of arguments.
180
181 GTAGSOBJDIR
182 If this variable is set, it is used as the name of BSD-style
183 objdir. The default is ´obj´. Though you can use MAKEOBJDIR
184 instead of GTAGSOBJDIR, it is deprecated.
185
186 GTAGSOBJDIRPREFIX
187 If this variable is set, it is used as the prefix of BSD-style
188 objdir. The default is ´/usr/obj´. Though you can use MAKEOB‐
189 JDIRPREFIX instead of GTAGSOBJDIRPREFIX, it is deprecated.
190
191 TMPDIR The location used to stored temporary files. The default is
192 ´/tmp´.
193
195 The following configuration variables affect the execution of gtags.
196 You can see the default value for each variable with the --config
197 option.
198
199 gtags_parser (comma separated list)
200 Specify the mapping of language names and plug-in parsers. Each
201 part delimited by the comma consists of a language name, a
202 colon, the shared object path, an optional colon followed by a
203 function name. If the function name is not specified, 'parser'
204 is assumed. As a special exception, gtags collects values from
205 multiple gtags_parser variables. For these mappings, the first
206 match is adopted.
207
208 gtags_hook (command line)
209 Specify a command line which should be executed at the beginning
210 of gtags after loading configuration file. You can use this hook
211 to update ´gtags.files´ dynamically. "./" in it always means
212 the project root directory, since gtags is always invoked there.
213
214 icase_path (boolean)
215 Ignore case distinctions in the path. Suffixes check is
216 affected by this capability.
217
218 langmap (comma separated list)
219 Language mapping. Each comma-separated map consists of a lan‐
220 guage name, a colon, and a list of file extensions. You can
221 specify a glob pattern surrounded by parentheses instead of an
222 extension for the files without extensions (e.g. Make:([Mm]ake‐
223 file).mak.mk). As a special exception, gtags collects values
224 from multiple langmap variables. For these mappings, the first
225 match is adopted. Default mapping is:
226 ´c:.c.h,yacc:.y,asm:.s.S,java:.java,cpp:.c++.cc.hh.cpp.cxx.hxx.hpp.C.H,php:.php.php3.phtml´.
227
228 skip (comma separated list)
229 Gtags skips files and directories which are given in this list.
230 As a special exception, gtags collects values from multiple skip
231 variables. If the value ends with ´/´, it is assumed as a
232 directory and gtags skips all files under it. The value may
233 include glob patterns (*, ?, [...], [!...], [^...]).
234
235 If the value starts with ´/´, it is assumed a relative path name
236 from the root directory of the project. You cannot use glob pat‐
237 terns for a path name. However, this direction is out-of-date,
238 and is not recommended. Instead, you can use -f option which can
239 be combined with find(1). Since find(1) has rich options to
240 select files, you can do everything. Additionally, this tech‐
241 nique can also be applied to any other tagging systems like
242 ctags(1), cscope(1), etc.
243
244 Skip list is also effective when you use the -f or
245 ´gtags.files´.
246
248 Gtags exits with a non-0 value if an error occurred, 0 otherwise.
249
250 Note that files created by gtags with a non-zero exit code should be
251 considered corrupted.
252
254 global(1), htags(1), gtags.conf(5).
255
256 GNU GLOBAL source code tag system
257 (http://www.gnu.org/software/global/).
258
260 ´GTAGS´ and ´GRTAGS´ are very large. In advance of using this command,
261 check the space of your disk.
262
263 Assembly support is far from complete. It extracts only ENTRY() and
264 ALTENTRY() from source file. Probably valid only for FreeBSD and Linux
265 kernel source.
266
267 There is no concurrency control about tag files.
268
270 Shigio YAMAGUCHI, Hideki IWAMOTO and others.
271
273 The gtags command appeared in FreeBSD 2.2.2.
274
275
276
277GNU Project June 2018 GTAGS(1)