Skip to contentSkip to conversation

allow to pass the number of parallel jobs via command line

PATCH New Jean-Christophe PLAGNIOL-VILLARD 3 participants 8 messages Sep 25, 2012 – Oct 4, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

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

use PARALLEL_JOBS=x for this

This will overwrite the value in BR2_JLEVEL

---
 Makefile            |    2 ++
 package/Makefile.in |    2 ++
 2 files changed, 4 insertions(+)
Makefile +2 -0
index 6536bca..13e8139 100644
@@ -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
package/Makefile.in +2 -0
index 64508b2..fcf5b13 100644
@@ -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)
Signature · 1 line
1.7.10.4
#1 lore raw

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> 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 ?

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

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

Quoted 7 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> 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.

Quoted 2 lines
Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> writes:

Hi,

Quoted 1 line
Quoted 1 line

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" ..

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

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

Quoted 9 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> writes:

Hi,

Quoted 1 line
Quoted 1 line

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

Quoted 6 lines

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.

#5 lore raw

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

Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> writes:

Hi,

Quoted 1 line
Quoted 1 line

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

Quoted 6 lines

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

Quoted 8 lines

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.

#6 lore raw

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

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> writes:

Hi,

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

Quoted 7 lines
Quoted 7 lines

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.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

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

Quoted 19 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <[email protected]> writes:

Hi,

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

Quoted 7 lines
Quoted 7 lines

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

Quoted 8 lines

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.