To add the headers to the ctags file I found this little gem. And I ended up using it like this:
#!/bin/bash
if [ ! -z $1 ];then
root_path=$1
else
root_path="."
fi
gcc -M ${root_path}/* 2> /dev/null | \
sed -e 's/^ //' -e 's/ \\$//g' | \
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | \
sed -e 's/^.*\.o: //' -e 's/ /\n/g' | \
cat - <(ls -d ${root_path}/*) | \
ctags-universal -R -L - --c-kinds=+p --fields=+iaS --extras=+q
# -e 's/^ //' -> Remove the first space
# -e 's/ \\&//g -> Remove the training '\'
# -e '/^$/d' -> Remove empty lines
# -e '/\.o:[ \t]*$/d' -> Remove the lines that have object file paths
# -e 's/^.*\.o: //' -> Remove the object path from the line
# -e 's/ /\n/g' | \ -> Separate several source files with a return
# cat - <(ls -d ${root_path}/*) -> Append the root_path files
I’m still missing the implementation of the header files though. for another day…