Re: Using named variables in canned recipes

2017-03-13 Thread Tony Theodore
> On 13 Mar 2017, at 02:02, LeJacq, Jean Pierre > wrote: > > Tony Theodore wrote: > >> It seems the variable `prog` is in scope from the calling loop and >> can be referenced in the template: >> >>define PROGRAM_template = >> $(prog): $$($(prog)_OBJS) $$($(prog)_LIBS:%=-l%) >> ALL

Re: Using named variables in canned recipes

2017-03-13 Thread Tony Theodore
> On 13 Mar 2017, at 02:10, Paul Smith wrote: > > Yes, absolutely. The point of the foreach function is that the loop > variable is visible in the scope of the loop body... otherwise foreach > is almost useless. Thanks, I just realised I don’t need to use `call` at all in the case where the po

Re: Using named variables in canned recipes

2017-03-12 Thread Paul Smith
On Sun, 2017-03-12 at 11:02 -0400, LeJacq, Jean Pierre wrote: > > I was wondering if this is defined behaviour and can be relied upon > > to work in future versions of make? > > This is similar to a following bug: > >   http://savannah.gnu.org/bugs/?49841 I don't think these are the same. _

Re: Using named variables in canned recipes

2017-03-12 Thread Paul Smith
On Sun, 2017-03-12 at 18:15 +1100, Tony Theodore wrote: > It seems the variable `prog` is in scope from the calling loop and > can be referenced in the template: > >     define PROGRAM_template = > $(prog): $$($(prog)_OBJS) $$($(prog)_LIBS:%=-l%) > ALL_OBJS   += $$($(prog)_OBJS) >     e

Re: Using named variables in canned recipes

2017-03-12 Thread LeJacq, Jean Pierre
Tony Theodore wrote: > Looking at an example of a canned recipe in: > > https://www.gnu.org/software/make/manual/make.html#Eval-Function > > define PROGRAM_template = > $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) > ALL_OBJS += $$($(1)_OBJS) > endef > > $(foreach prog,$(PROGR