Skip to content

Instantly share code, notes, and snippets.

@asauber
Last active August 29, 2015 14:03
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 asauber/30d264d41eef3f821c21 to your computer and use it in GitHub Desktop.
Save asauber/30d264d41eef3f821c21 to your computer and use it in GitHub Desktop.
Script to generate ctags including dependencies
#!/bin/bash
# Usage: $ ./ctags_with_deps.sh *
CC="gcc"
CFLAGS=""
CTAGSFLAGS=""
# Use the .ctagshelp file as a configuration file for your compiler and ctags
#
# Example .ctagshelp file below. These values were needed to get all of the
# tags for a project that used an Intel library which used non-standard file
# extensions and raised some compiler errors.
#
# !/bin/bash
#
# CC="g++"
#
# CFLAGS="-Igen "\
# "-I/home/user/src/pin/pin-2.13-62732-gcc.4.4.7-linux/extras/components/include "\
# "-I/home/user/src/pin/pin-2.13-62732-gcc.4.4.7-linux/extras/xed2-ia32/include "\
# "-DTARGET_IA32E -DHOST_IA32E -DTARGET_LINUX"
#
# CTAGSFLAGS="--language-force=c++"
#
source .ctagshelp
$CC -M -I. $CFLAGS $* | \
sed -e 's/[\\ ]/\n/g' | \
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | \
ctags $CTAGSFLAGS -L - --c++-kinds=+p --fields=+iaS --extra=+q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment