Skip to content

Instantly share code, notes, and snippets.

@k4rtik
Created August 24, 2017 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k4rtik/7cd52eb8dbf408c66cfc38e479baca4b to your computer and use it in GitHub Desktop.
Save k4rtik/7cd52eb8dbf408c66cfc38e479baca4b to your computer and use it in GitHub Desktop.
For generating cscope tags for a C/C++ project
#!/bin/bash
CSCOPE_DIR="$PWD/cscope"
if [ ! -d "$CSCOPE_DIR" ]; then
mkdir "$CSCOPE_DIR"
fi
echo "Finding files ..."
find "$PWD" -name '*.[ch]' \
-o -name '*.cpp' \
-o -name '*.cc' \
-o -name '*.hpp' > "$CSCOPE_DIR/cscope.files"
echo "Adding files to cscope db: $PWD/cscope.db ..."
cscope -b -i "$CSCOPE_DIR/cscope.files"
export CSCOPE_DB="$PWD/cscope.out"
echo "Exported CSCOPE_DB to: '$CSCOPE_DB'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment