help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

caching included makefile contents


From: Noel Yap
Subject: caching included makefile contents
Date: Fri, 10 Oct 2003 18:07:49 -0400

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]