Skip to content

Commit

Permalink
android-rebuild.sh: Better parallel builds.
Browse files Browse the repository at this point in the history
This patch computes the number of CPUs on the host to
automatically used it with 'make -j<number>'.

Change-Id: If4e2d8b159662f5b7f02e8e48447b9916e7051b2
  • Loading branch information
digit-android committed Jun 1, 2011
1 parent 826b985 commit c3b08a0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions android-rebuild.sh
Expand Up @@ -6,8 +6,22 @@
# assume that the device tree is in TOP
#

case $(uname -s) in
Linux)
HOST_NUM_CPUS=`cat /proc/cpuinfo | grep processor | wc -l`
;;
Darwin|FreeBsd)
HOST_NUM_CPUS=`sysctl -n hw.ncpu`
;;
CYGWIN*|*_NT-*)
HOST_NUM_CPUS=$NUMBER_OF_PROCESSORS
;;
*) # let's play safe here
HOST_NUM_CPUS=1
esac

cd `dirname $0`
./android-configure.sh $* && \
make clean && \
make -j4 && \
rm -rf objs &&
./android-configure.sh $@ &&
make -j$HOST_NUM_CPUS &&
echo "Done. !!"

0 comments on commit c3b08a0

Please sign in to comment.