From c3b08a0914def3f380aa57bbcb3937315ce15ceb Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Tue, 10 May 2011 12:58:05 +0200 Subject: android-rebuild.sh: Better parallel builds. This patch computes the number of CPUs on the host to automatically used it with 'make -j'. Change-Id: If4e2d8b159662f5b7f02e8e48447b9916e7051b2 --- android-rebuild.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'android-rebuild.sh') 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. !!" -- cgit v1.1