It would greatly increase the expressiveness of GNU make's macro expansion if it was possible to define recursive macro functions. For example, here's a function that performs calculates the transitive closure of a set of dependencies:
# If $(firstword) is car, this is cdr: rest = $(wordlist 1,$(words ${1}),${1}) tclose = $(if ${1},$(firstword ${1}) \ $(call tclose,$(sort ${DEP_$(firstword ${1})} \ $(call rest,${1})))) You could then define variables ala: DEP_foo = bar baz quux DEP_baz = quux blarp and expect $(sort $(call tclose,foo)) to expand to "bar baz blarp quux" Unfortunately, the restriction on recursive macros not referencing themselves includes references via $(call). I would argue that GNU make should not try to protect someone from themself if the write a recursive $(call). Yes, you can trivially write infinite loops if it's allowed, but the increase in expressiveness is substantial. (Yes, you can write a version of tclose that expands the dependencies up to a present depth, but that's a kludge. I would rather call out to the shell and do the full expansion there then do that.) Philip Guenther _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make