From: Mike Frysinger Date: Tue, 9 Dec 2008 00:56:24 -0500 Subject: [U-Boot] [PATCH] MAKEALL: Automatically use parallel builds In-Reply-To: <1228779685-21108-1-git-send-email-wd@denx.de> References: <1228779685-21108-1-git-send-email-wd@denx.de> Message-ID: <200812090056.25498.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday 08 December 2008 18:41:25 Wolfgang Denk wrote: > Add logic to the MAKEALL script to determine the number of CPU cores > on the system, and run a parallel build if there is more than one. > Usually this significantrly accelerates builds. > > Allow to manually adjust the number of parallel make jobs by using > the "BUILD_NCPUS" environment variable. > > Signed-off-by: Wolfgang Denk > --- > MAKEALL | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/MAKEALL b/MAKEALL > index dbed268..a16549c 100755 > --- a/MAKEALL > +++ b/MAKEALL > @@ -1,6 +1,15 @@ > #!/bin/sh > > -: ${JOBS:=} > +# Determine number of CPU cores if no default was set > +: ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"} > + > +if [ "$BUILD_NCPUS" -gt 1 ] no point in quoting here ... if it isnt numeric, then -gt will fail, and all numeric values lack whitespace ... > +then > + JOBS=-j`expr "$BUILD_NCPUS" + 1` > +else > + JOBS="" > +fi i generally see the heuristic (cpus * 2) rather than (cpus + 1) ... benchmarks tend to favor that as well ... but this is certainly better than previous behavior: always use -j1 ... -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20081209/f27dd735/attachment.pgp