Advertisement
k5t4j5

Untitled

Apr 25th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. # clear the source var so we can't inherit the value twice
  2. #
  3. # $(1): context prefix
  4. # $(2): name of this node
  5. # $(3): list of variable names
  6. #
  7. define _expand-inherited-values
  8. $(foreach v,$(3), \
  9. $(eval ### "Shorthand for the name of the target variable") \
  10. $(eval _eiv_tv := $(1).$(2).$(v)) \
  11. $(eval ### "Get the list of nodes that this variable inherits") \
  12. $(eval _eiv_i := \
  13. $(sort \
  14. $(patsubst $(INHERIT_TAG)%,%, \
  15. $(filter $(INHERIT_TAG)%, $($(_eiv_tv)) \
  16. )))) \
  17. $(foreach i,$(_eiv_i), \
  18. $(eval ### "Make sure that this inherit appears only once") \
  19. $(eval $(_eiv_tv) := \
  20. $(call uniq-word,$($(_eiv_tv)),$(INHERIT_TAG)$(i))) \
  21. $(eval ### "Expand the inherit tag") \
  22. $(eval $(_eiv_tv) := \
  23. $(strip \
  24. $(patsubst $(INHERIT_TAG)$(i),$($(1).$(i).$(v)), \
  25. $($(_eiv_tv))))) \
  26. $(eval ### "Clear the child so DAGs don't create duplicate entries" ) \
  27. $(eval $(1).$(i).$(v) :=) \
  28. $(eval ### "If we just inherited ourselves, it's a cycle.") \
  29. $(if $(filter $(INHERIT_TAG)$(2),$($(_eiv_tv))), \
  30. $(warning Cycle detected between "$(2)" and "$(i)" for context "$(1)") \
  31. $(error import of "$(2)" failed) \
  32. ) \
  33. ) \
  34. ) \
  35. $(eval _eiv_tv :=) \
  36. $(eval _eiv_i :=)
  37. endef
  38.  
  39. #
  40. # $(1): context prefix
  41. # $(2): makefile representing this node
  42. # $(3): list of node variable names
  43. #
  44. # _include_stack contains the list of included files, with the most recent files first.
  45. define _import-node
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement