quant
quant

Reputation: 23082

How do I build a GNU Global tags file with files not in the root directory?

Say I have a directory structure like this:

~/sourcecode1/myproject
~/sourcecode2/myproject

I want to use gtags in vim to find calls to functions declared in both the sourcecode1 and sourcecode2 trees, with calls coming from either of those trees (e.g. a function defined in ~/sourcecode1/myproject/somefile.cpp might call a function declared in ~/sourcecode2/myproject/someotherfile.hpp). I do not want to tag any other folders other than the myproject folders.

. How do I build my tags files to achieve this? Currently I've just been running gtags within one of the two directories, and then foregoing gtags functionality when looking through files in the other directory.

Surely there's a better way!

Also, not sure if this belongs in SU.

Upvotes: 0

Views: 3128

Answers (1)

shigio
shigio

Reputation: 666

Although I may not understand your question, is that you are asking this?

$ find */myproject -type f -print >gtags.files
$ gtags

See http://www.gnu.org/software/global/globaldoc_toc.html#Applied-usage (which gives a similar solution, but saves the file list under /tmp) and http://www.gnu.org/software/global/globaldoc_toc.html#gtags (or $ man gtags).

Upvotes: 1

Related Questions