android_make revision a61ba109bf1a60c6de8f9ebea043e782497b88cc
1#!/bin/bash
2
3SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
5# remove the existing .android_config file prior to running android_setup. If
6# we did not remove this here then we would build for whatever device type was
7# listed in the .android_config instead of the default device type.
8if [ -f .android_config ]
9then
10  rm .android_config
11fi
12
13# run the config to setup the environment
14source $SCRIPT_DIR/android_setup.sh
15
16# write the device id into the .android_config file
17echo $DEVICE_ID > .android_config
18
19for arg in ${APP_ARGS[@]}
20do
21  if [[ "${arg}" == "--use-ccache" ]];
22  then
23    if [[ -z "$ANDROID_MAKE_CCACHE" ]];
24    then
25      ANDROID_MAKE_CCACHE=$(which ccache)
26    fi
27  else
28    makeVars=("${makeVars[@]}" "${arg}")
29  fi
30
31shift
32done
33
34if [[ -n "$ANDROID_MAKE_CCACHE" ]]; then
35  $ANDROID_MAKE_CCACHE --version &> /dev/null
36  if [[ "$?" != "0" ]]; then
37    echo "Unable to find ccache!"
38    exit 1
39  fi
40fi
41
42make ${makeVars[@]}
43if [ $? != 0 ]
44then
45  exit 1;
46fi
47