Quantcast
Channel: Vimタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 5608

Create cscope & ctags tags recursively (C/C++)

$
0
0

Using -M flag of gcc to list included files, then use those files for the tags.

gcc will give errors for libraries not in the default include path.
I added those one by one using -I

#!/bin/bashCSCOPE_DIR="$PWD/cscope"if[!-d"$CSCOPE_DIR"];then
    mkdir"$CSCOPE_DIR"fi

echo"finding files..."
gcc -M`pkg-config --cflags--libs lilv-0``pkg-config --cflags--libs suil-0`\`find .-name"*.h"-printf"%h\n" | awk'!x[$0]++' | sed-e's/^/-I /'`\`pkg-config --cflags--libs sord-0`\`find /usr/include/x86_64-linux-gnu/qt5/ -type d -print | sed-e's/^/-I /'`\`pkg-config --cflags--libs gtk+-2.0``pkg-config --cflags--libs glib-2.0`\`pkg-config --cflags--libs gtkmm-2.4`\-fPIC"$@" | sed-e's/[\\ ]/\n/g' | \sed-e'/^$/d'-e'/\.o:[ \t]*$/d'>"$CSCOPE_DIR/cscope.files.tmp"awk'!a[$0]++'"$CSCOPE_DIR/cscope.files.tmp">"$CSCOPE_DIR/cscope.files"rm"$CSCOPE_DIR/cscope.files.tmp"echo"building cscope db...."
cscope -b-i"$CSCOPE_DIR/cscope.files"echo"building ctags db..."
ctags -L"$CSCOPE_DIR/cscope.files"--c++-kinds=+p --fields=+iaS --extra=+q

Viewing all articles
Browse latest Browse all 5608

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>