I'm trying to cache the contents of included makefiles with the following functions:

# sets __FILE__ macro to file to be included, then includes the file.
# allows included file to know where it is in relation to includer.
# $(1) is the file to be included
# $(2) is the current value of $(__FILE__)
define _include-makefile
  __FILE__ := $(1)

  ifndef $$(__FILE__).contents
    $$(__FILE__).contents := $$(shell cat $$(__FILE__))
  endif

  $$(__FILE__)

  __FILE__ := $(2)
endef

# include makefile passing in its name as __FILE__
# $(1) is the file to be included
include-makefile = $(eval $(call _include-makefile,$(1),$(__FILE__)))

which are used in the following way:
$(call include-makefile,Another.mk)

but it's generating the error:

GNUmakefile:37: *** missing separator.  Stop.

I think it's a white space issue.  Does anyone have any suggestions on how to work 
around it?

Thanks,
Noel
-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive 
confidentiality or privilege, and use is prohibited.


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to