• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
24DIR=$ANDROID_NDK_ROOT
25
26if [ -f $DIR/RELEASE/TXT ]; then
27    echo "ERROR: You cannot run this script in a release directory !"
28    exit 1
29fi
30if [ ! -d $DIR/.git ] ; then
31    echo "ERROR: You must call this script in a development directory !"
32    exit 1
33fi
34
35# Remove generated directories
36rm -rf $DIR/platforms
37rm -rf $DIR/toolchains/*/prebuilt
38rm -rf $DIR/samples
39rm -rf $DIR/prebuilt
40
41# Remove prebuilt binaries
42rm -rf $DIR/$STLPORT_SUBDIR/libs
43rm -rf $DIR/$GABIXX_SUBDIR/libs
44for VERSION in $DEFAULT_GCC_VERSION_LIST; do
45    rm -rf $DIR/$GNUSTL_SUBDIR/$VERSION
46done
47rm -rf $DIR/$LIBPORTABLE_SUBDIR
48rm -rf $DIR/$COMPILER_RT_SUBDIR/libs
49rm -rf $DIR/$GCCUNWIND_SUBDIR/libs
50rm -rf $DIR/$LIBCXX_SUBDIR/libs
51
52rm -f $DIR/ndk-stack*
53rm -f $DIR/ndk-depends*
54
55clean_dir ()
56{
57    if [ -d "$1" ] ; then
58        echo "rm -rf $1"
59        rm -rf $1
60    fi
61}
62
63clean_file ()
64{
65    if [ -f "$1" ] ; then
66        echo "rm -f $1"
67        rm -f $1
68    fi
69}
70
71cleanup_project ()
72{
73    clean_dir  $1/obj
74    clean_dir  $1/libs
75    clean_dir  $1/bin
76    clean_dir  $1/gen
77    clean_file $1/build.xml
78    clean_file $1/local.properties
79}
80
81# Cleanup the tests
82DIR=$ANDROID_NDK_ROOT
83for PROJECT in $DIR/tests/build/*; do
84    cleanup_project $PROJECT
85done
86for PROJECT in $DIR/tests/device/*; do
87    cleanup_project $PROJECT
88done
89
90# Cleanup development/ndk
91DIR=`dirname $ANDROID_NDK_ROOT`/development/ndk
92if [ ! -d $DIR ] ; then
93    echo "WARNING: Development directory missing: $DIR"
94    exit 0
95fi
96for PROJECT in $DIR/samples/*; do
97    cleanup_project $PROJECT
98done
99for PROJECT in $DIR/platforms/android-*/samples/*; do
100    cleanup_project $PROJECT
101done
102