aboutsummaryrefslogtreecommitdiffstats
path: root/android-rebuild.sh
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-10 12:58:05 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-06-01 16:20:26 +0200
commitc3b08a0914def3f380aa57bbcb3937315ce15ceb (patch)
treeb60b27f9baaf1618c17fd182e6b9982ee4c99583 /android-rebuild.sh
parent826b985e543e12f83c396922d9c6562050e0f9f6 (diff)
downloadexternal_qemu-c3b08a0914def3f380aa57bbcb3937315ce15ceb.zip
external_qemu-c3b08a0914def3f380aa57bbcb3937315ce15ceb.tar.gz
external_qemu-c3b08a0914def3f380aa57bbcb3937315ce15ceb.tar.bz2
android-rebuild.sh: Better parallel builds.
This patch computes the number of CPUs on the host to automatically used it with 'make -j<number>'. Change-Id: If4e2d8b159662f5b7f02e8e48447b9916e7051b2
Diffstat (limited to 'android-rebuild.sh')
-rwxr-xr-xandroid-rebuild.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/android-rebuild.sh b/android-rebuild.sh
index 136ccc9..d4bdc0a 100755
--- a/android-rebuild.sh
+++ b/android-rebuild.sh
@@ -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. !!"