1 #!/bin/sh 2 # 3 # Copyright (C) 2010 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 # 17 # dev-cleanup.sh 18 # 19 # Remove any intermediate files (e.g. object files) from the development 20 # directories. 21 # 22 . `dirname $0`/prebuilt-common.sh 23 24 DIR=$ANDROID_NDK_ROOT 25 26 if [ -f $DIR/RELEASE/TXT ]; then 27 echo "ERROR: You cannot run this script in a release directory !" 28 exit 1 29 fi 30 if [ ! -d $DIR/.git ] ; then 31 echo "ERROR: You must call this script in a development directory !" 32 exit 1 33 fi 34 35 # Remove generated directories 36 rm -rf $DIR/platforms 37 rm -rf $DIR/prebuilt 38 39 # Remove prebuilt binaries 40 rm -rf $DIR/$STLPORT_SUBDIR/libs 41 rm -rf $DIR/$GABIXX_SUBDIR/libs 42 for VERSION in $DEFAULT_GCC_VERSION_LIST; do 43 rm -rf $DIR/$GNUSTL_SUBDIR/$VERSION 44 done 45 rm -rf $DIR/$COMPILER_RT_SUBDIR/libs 46 rm -rf $DIR/$GCCUNWIND_SUBDIR/libs 47 rm -rf $DIR/$LIBCXX_SUBDIR/libs 48 rm -rf $DIR/$SUPPORT_SUBDIR/libs 49 50 # Remove the temp directory. 51 rm -rf $TMPDIR 52 53 clean_dir () 54 { 55 if [ -d "$1" ] ; then 56 echo "rm -rf $1" 57 rm -rf $1 58 fi 59 } 60 61 clean_file () 62 { 63 if [ -f "$1" ] ; then 64 echo "rm -f $1" 65 rm -f $1 66 fi 67 } 68 69 cleanup_project () 70 { 71 clean_dir $1/obj 72 clean_dir $1/libs 73 clean_dir $1/bin 74 clean_dir $1/gen 75 clean_file $1/build.xml 76 clean_file $1/local.properties 77 } 78 79 # Cleanup the tests 80 DIR=$ANDROID_NDK_ROOT 81 for PROJECT in $DIR/tests/build/*; do 82 cleanup_project $PROJECT 83 done 84 for PROJECT in $DIR/tests/device/*; do 85 cleanup_project $PROJECT 86 done 87 88 # Cleanup development/ndk 89 DIR=`dirname $ANDROID_NDK_ROOT`/development/ndk 90 if [ ! -d $DIR ] ; then 91 echo "WARNING: Development directory missing: $DIR" 92 exit 0 93 fi 94