Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # clear the source var so we can't inherit the value twice
- #
- # $(1): context prefix
- # $(2): name of this node
- # $(3): list of variable names
- #
- define _expand-inherited-values
- $(foreach v,$(3), \
- $(eval ### "Shorthand for the name of the target variable") \
- $(eval _eiv_tv := $(1).$(2).$(v)) \
- $(eval ### "Get the list of nodes that this variable inherits") \
- $(eval _eiv_i := \
- $(sort \
- $(patsubst $(INHERIT_TAG)%,%, \
- $(filter $(INHERIT_TAG)%, $($(_eiv_tv)) \
- )))) \
- $(foreach i,$(_eiv_i), \
- $(eval ### "Make sure that this inherit appears only once") \
- $(eval $(_eiv_tv) := \
- $(call uniq-word,$($(_eiv_tv)),$(INHERIT_TAG)$(i))) \
- $(eval ### "Expand the inherit tag") \
- $(eval $(_eiv_tv) := \
- $(strip \
- $(patsubst $(INHERIT_TAG)$(i),$($(1).$(i).$(v)), \
- $($(_eiv_tv))))) \
- $(eval ### "Clear the child so DAGs don't create duplicate entries" ) \
- $(eval $(1).$(i).$(v) :=) \
- $(eval ### "If we just inherited ourselves, it's a cycle.") \
- $(if $(filter $(INHERIT_TAG)$(2),$($(_eiv_tv))), \
- $(warning Cycle detected between "$(2)" and "$(i)" for context "$(1)") \
- $(error import of "$(2)" failed) \
- ) \
- ) \
- ) \
- $(eval _eiv_tv :=) \
- $(eval _eiv_i :=)
- endef
- #
- # $(1): context prefix
- # $(2): makefile representing this node
- # $(3): list of node variable names
- #
- # _include_stack contains the list of included files, with the most recent files first.
- define _import-node
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement