Hi,

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?

Thanks,

Tony


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to