bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic adjustments of build dependencies for the number of availabl


From: Paul Smith
Subject: Re: Dynamic adjustments of build dependencies for the number of available processors
Date: Mon, 05 Jan 2015 14:23:07 -0500

On Mon, 2015-01-05 at 20:06 +0100, SF Markus Elfring wrote:
> > So you have in your toolbox $(shell) and $(eval).
> 
> I am not familiar enough with the second make function.
> http://www.gnu.org/software/make/manual/html_node/Eval-Function.html

I wrote some blog posts about eval and other metaprogramming techniques
in make that you might find interesting:

http://make.mad-scientist.net/category/metaprogramming/

But, note that these don't have any relationship to make's jobserver and
how many parallel jobs it will run.

> > NPROC:=$(shell grep "processor" /proc/cpuinfo  | cut -b12- )
> > # this returns "0 1 2 3" etc
> > 
> > # Then you might use eval to generate rules dynamically:
> > 
> > $(foreach N,$(NPROC),$(eval
> >    # YOUR DYNAMIC RULE
> >   MYTARGET_$(N):
> > <TAB>mytool --dosomething -o$@
> >   )
> > )

I guess I don't really see what the purpose of this is.  If you have 2
CPUs you get targets MYTARGET_0 and MYTARGET_1.  If you have 4 CPUs you
get targets MYTARGET_0, MYTARGET_1, MYTARGET_2, MYTARGET_3.

So... then what?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]