In my build system, I wrote an include-makefile macro that'll define __FILE__ and keep a MAKEFILE_STACK such that an included makefile always knew where it was in relation to its includer (assuming relative paths are used). Doing this allows for position-independent makefiles, which, in turn allows for modular, non-recursive makefiles.
For example, the following module makefile may exist:
# c++/GNUcommon.mk
$(call include-makefile,$(call dirname,$(__FILE__))/GNUactions.mk) $(call include-makefile,$(call dirname,$(__FILE__))/GNUrules.mk)
and the client may include it in whichever way they wish:
# GNUmakefile
$(call include-makefile,/path/to/makefiles/1.0/c++/GNUcommon.mk)
Noel
Boris Kolpackov wrote:
Dave Yost <[EMAIL PROTECTED]> writes:
Consider a Makefile that starts thus:
include ../../../Makefile-master
It would be nice if this included Makefile-master knew where it was,
$(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
-boris
_______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make
_______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make