I think I have made some fundamental realizations about what GNU Make is doing in my example that helps me to clarify some things.
If my PROCESS_FRAGMENT template were instead defined as: --- define PROCESS_FRAGMENT -include $(1).mk $(call TEST_RULE,$(1),$(VARIABLE)) endef --- Then the problem is that I am expecting VARIABLE, when set via the -include of $(1).mk, to be used when evaluating the inner $(call) of the TEST_RULE template. But what I didn't realize was that $(VARIABLE) is expanded as part of the expansion of the text of the entire template, which happens *before* the "-include $(1).mk" directive is processed by GNU Make as makefile text (which itself only happens because the outer $(eval) function instructs GNU Make to do so). So as a result, $(VARIABLE) contains *nothing* when the template is being expanded, which is not what I wanted. The subtle problem is that the evaluation of the $(call) tries to replace all variable references and function calls *before* the outer $(eval) even gets a chance to execute the -include directive that would supply values to be used when the $(call) is evaluated. I am still trying to think of a way around this than is better than what I eventually came up with. What I eventually came up with was this: --- define PROCESS_FRAGMENT -include $(1).mk $$(eval $$(call TEST_RULE,$(1),$$(VARIABLE))) endef --- This only worked because I was preventing the expansion of the outer $(call) function from further expanding the inner $$(VARIABLE) reference and $$(call) function, thus preventing the premature subtitution of the value of $(VARIABLE). And I had to add an $$(eval) to wrap around it because otherwise the outer $(eval) would evaluate this, resulting in some text which wasn't then itself evaluated. Is there a better solution? Thanks, Bryan ------------------------------------------------------------------------ Bryan Ischo [EMAIL PROTECTED] 2001 Mazda 626 GLX Hamilton, New Zealand http://www.ischo.com RedHat Fedora Core 5 ------------------------------------------------------------------------ _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
