help-make
[Top][All Lists]
Advanced

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

Re: Using named variables in canned recipes


From: LeJacq, Jean Pierre
Subject: Re: Using named variables in canned recipes
Date: Sun, 12 Mar 2017 11:02:22 -0400
User-agent: KNode/4.14.1

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,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
> 
> 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)
>     endef
> 
> 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

Can you see what the flavor reports?

-- 
JP





reply via email to

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