[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using named variables in canned recipes
From: |
Tony Theodore |
Subject: |
Using named variables in canned recipes |
Date: |
Sun, 12 Mar 2017 18:15:47 +1100 |
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
- Using named variables in canned recipes,
Tony Theodore <=