config/scripts/generate_cscopefile.sh
2015-10-29 11:45:15 +01:00

49 lines
1.1 KiB
Bash
Executable File

DIR="bionic dalvik device frameworks hardware libnativehelper system packages"
TMP=$(mktemp /tmp/XXXXX-cscope.files)
gettop ()
{
local TOPFILE=build/core/envsetup.mk;
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ]; then
echo $TOP;
else
if [ -f $TOPFILE ]; then
PWD= /bin/pwd;
else
local HERE=$PWD;
T=;
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
\cd ..;
T=`PWD= /bin/pwd`;
done;
\cd $HERE;
if [ -f "$T/$TOPFILE" ]; then
echo $T;
fi;
fi;
fi
}
T=$(gettop);
if [ "$T" ]; then
\cd $(gettop);
else
echo "Couldn't locate the top of the tree. Try setting TOP.";
exit
fi
for dir in $DIR;
do
echo "Looking for files in $dir"
find $PWD/$dir -name .git -prune -o -type f \( -iname '*.c' -o -iname '*.cc' -o -iname '*.cpp' -o -iname '*.h' -o -iname '*.hpp' -o -iname "*.mk" -o -iname "*.java" -o -iname "*.aidl" \) | egrep -v "/\.git$" >> $TMP
done
echo "generate cscope"
cscope -bkq -i $TMP
echo "generate ctags"
ctags --c-kinds=+px --c++-kinds=+px --fields=+iaS --extra=+q -L $TMP
rm $TMP