[1/1] allow to pass the number of parallel jobs via command line

Submitted by Jean-Christophe PLAGNIOL-VILLARD on Sept. 25, 2012, 10:17 a.m.

Details

Message ID 1348568223-13874-1-git-send-email-plagnioj@jcrosoft.com
State Not Applicable
Headers show

Commit Message

Jean-Christophe PLAGNIOL-VILLARD Sept. 25, 2012, 10:17 a.m.
use PARALLEL_JOBS=x for this

This will overwrite the value in BR2_JLEVEL

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 Makefile            |    2 ++
 package/Makefile.in |    2 ++
 2 files changed, 4 insertions(+)

Comments

Peter Korsgaard Sept. 25, 2012, 8:36 p.m.
>>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:

 Jean-Christophe> use PARALLEL_JOBS=x for this
 Jean-Christophe> This will overwrite the value in BR2_JLEVEL

why not just use make BR2_JLEVEL=x ?
Jean-Christophe PLAGNIOL-VILLARD Sept. 26, 2012, 6:23 a.m.
On 22:36 Tue 25 Sep     , Peter Korsgaard wrote:
> >>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
> 
>  Jean-Christophe> use PARALLEL_JOBS=x for this
>  Jean-Christophe> This will overwrite the value in BR2_JLEVEL
> 
> why not just use make BR2_JLEVEL=x ?
> 
kconfig overwrite and you can not optarg env as BR2_JLEVEL is a int

so need to use PARALLEL_JOBS

Best Regards,
J.
> -- 
> Bye, Peter Korsgaard
Peter Korsgaard Sept. 26, 2012, 10:42 a.m.
>>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:

Hi,

 >> why not just use make BR2_JLEVEL=x ?

 JC> kconfig overwrite and you can not optarg env as
 JC> BR2_JLEVEL is a int so need to use PARALLEL_JOBS

Sorry, I don't understand what you are saying here. BR2_JLEVEL works
fine:

make BR2_LEVEL=42
...
/usr/bin/make -j42 CC="/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc" ..
Jean-Christophe PLAGNIOL-VILLARD Sept. 26, 2012, 4:57 p.m.
On 12:42 Wed 26 Sep     , Peter Korsgaard wrote:
> >>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
> 
> Hi,
> 
>  >> why not just use make BR2_JLEVEL=x ?
> 
>  JC> kconfig overwrite and you can not optarg env as
>  JC> BR2_JLEVEL is a int so need to use PARALLEL_JOBS
> 
> Sorry, I don't understand what you are saying here. BR2_JLEVEL works
> fine:
> 
> make BR2_LEVEL=42
> ...
> /usr/bin/make -j42 CC="/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc" ..
here does not work

I try this

with a value of BR2_JLEVEL at 4

BR2_JLEVEL=13 make

...
/usr/bin/make -j2 -C /opt/work/buildroot/build/test/toolchain/gcc-4.6.3-initial all-gcc

I want to pass the JLEVEL via env not make option

Best Regards,
J.
Nathan Lynch Sept. 26, 2012, 7:23 p.m.
On Wed, 2012-09-26 at 18:57 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote:
> On 12:42 Wed 26 Sep     , Peter Korsgaard wrote:
> > >>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
> > 
> > Hi,
> > 
> >  >> why not just use make BR2_JLEVEL=x ?
> > 
> >  JC> kconfig overwrite and you can not optarg env as
> >  JC> BR2_JLEVEL is a int so need to use PARALLEL_JOBS
> > 
> > Sorry, I don't understand what you are saying here. BR2_JLEVEL works
> > fine:
> > 
> > make BR2_LEVEL=42
> > ...
> > /usr/bin/make -j42 CC="/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc" ..
> here does not work
> 
> I try this
> 
> with a value of BR2_JLEVEL at 4
> 
> BR2_JLEVEL=13 make
> 
> ...
> /usr/bin/make -j2 -C /opt/work/buildroot/build/test/toolchain/gcc-4.6.3-initial all-gcc
> 
> I want to pass the JLEVEL via env not make option

Use make -e (--environment-overrides)?  I dunno, things might break
depending on what's in your environment.  But if your use case has this
constraint hopefully you are able to sanitize your environment before
invoking Buildroot.
Peter Korsgaard Oct. 1, 2012, 7:46 p.m.
>>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:

Hi,

 JC> kconfig overwrite and you can not optarg env as
 JC> BR2_JLEVEL is a int so need to use PARALLEL_JOBS
 >> 
 >> Sorry, I don't understand what you are saying here. BR2_JLEVEL works
 >> fine:
 >> 
 >> make BR2_LEVEL=42
 >> ...
 >> /usr/bin/make -j42 CC="/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc" ..
 Jean-Christophe> here does not work

 Jean-Christophe> I try this

 Jean-Christophe> with a value of BR2_JLEVEL at 4

 Jean-Christophe> BR2_JLEVEL=13 make

That doesn't work. Variables defined on the make commandline take
precedence over definitions in makefiles, but environment variables
don't (and should not, stuff would break all the time).

Just use make BR2_JLEVEL=$BR2_JLEVEL to get your shell to expand the
variable for you.
Jean-Christophe PLAGNIOL-VILLARD Oct. 4, 2012, 6:57 a.m.
On 21:46 Mon 01 Oct     , Peter Korsgaard wrote:
> >>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
> 
> Hi,
> 
>  JC> kconfig overwrite and you can not optarg env as
>  JC> BR2_JLEVEL is a int so need to use PARALLEL_JOBS
>  >> 
>  >> Sorry, I don't understand what you are saying here. BR2_JLEVEL works
>  >> fine:
>  >> 
>  >> make BR2_LEVEL=42
>  >> ...
>  >> /usr/bin/make -j42 CC="/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc" ..
>  Jean-Christophe> here does not work
> 
>  Jean-Christophe> I try this
> 
>  Jean-Christophe> with a value of BR2_JLEVEL at 4
> 
>  Jean-Christophe> BR2_JLEVEL=13 make
> 
> That doesn't work. Variables defined on the make commandline take
> precedence over definitions in makefiles, but environment variables
> don't (and should not, stuff would break all the time).
> 
> Just use make BR2_JLEVEL=$BR2_JLEVEL to get your shell to expand the
> variable for you.
issue I can not do so

and env var are use commonly linux/barebox I expect this on buildroot too

Best Regards,
J.

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index 6536bca..13e8139 100644
--- a/Makefile
+++ b/Makefile
@@ -730,6 +730,8 @@  endif
 	@echo '  make V=0|1             - 0 => quiet build (default), 1 => verbose build'
 	@echo '  make O=dir             - Locate all output files in "dir", including .config'
 	@echo
+	@echo '  make PARALLEL_JOBS=x   - X => number of jobs for each package this overwrite the KConfig BR2_JLEVEL'
+	@echo
 	@$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
 	  printf "  %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
 	@echo
diff --git a/package/Makefile.in b/package/Makefile.in
index 64508b2..fcf5b13 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -9,12 +9,14 @@  HOSTMAKE :=$(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
 # If BR2_LEVEL is 0, scale the maximum concurrency with the number of
 # CPUs.  A coefficient of 2 is used in order to keep processors busy
 # while waiting on I/O.
+ifeq ($(PARALLEL_JOBS),)
 ifeq ($(BR2_JLEVEL),0)
 PARALLEL_JOBS:=$(shell echo \
 	$$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
 else
 PARALLEL_JOBS:=$(BR2_JLEVEL)
 endif
+endif
 
 MAKE1:=$(HOSTMAKE) -j1
 MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)