viji
viji

Reputation: 2926

Build cscope.out files in a separate directory

I've source code of a huge project in one directory (/my/src/) and I want the cscope files to be built in some other directory (/my/db/). How can I do that ?

Upvotes: 7

Views: 10765

Answers (2)

me_astr
me_astr

Reputation: 1042

If you have large number of files that are not part of git repo and if it is unnecessarily making cscope command slow. You can use below command to create cscople file (will work for java/javascript/python/c/go/c++ project).

git ls-files | grep '\.js$\|\.java$\|\.py$\|\.go$\|\.c$\|\.cpp$\|\.cc$\|\.hpp$' > /my/db/cscope.files
cscope -b -i /my/db/cscope.files
CSCOPE_DB=/my/db/cscope.out; export CSCOPE_DB 

Upvotes: 0

Deqing
Deqing

Reputation: 14652

Try following steps:

1 . Generate cscope.files

find /my/src -name '*.c' -o -name '*.h' > /my/db/cscope.files

2 . Run cscope on the generated result

cscope -i /my/db/cscope.files

3 . Export to environment variable

CSCOPE_DB=/my/db/cscope.out; export CSCOPE_DB 

Upvotes: 19

Related Questions