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?


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to