diff --git a/tools/aosp_cscope b/tools/aosp_cscope new file mode 100755 index 0000000..23b00bf --- /dev/null +++ b/tools/aosp_cscope @@ -0,0 +1,45 @@ +DIR="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 + +rm $TMP