[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: need access to Makefile path
From: |
Noel Yap |
Subject: |
Re: need access to Makefile path |
Date: |
Tue, 18 May 2004 12:55:31 -0400 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040212) |
Unless MAKEFILE_LIST is used before any other includes, using the trick below doesn't work. I think it's also quite messy to have to create explicitly a variable to hold this information in each makefile that needs it. Moreover, there's no guarantee that
someone won't overwrite the variable in which this information is stored. I think MAKEFILE_LIST is very lacking. A MAKEFILE_STACK would be much better.
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 <address@hidden> 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
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-make
- need access to Makefile path, Dave Yost, 2004/05/18
- Re: need access to Makefile path, Boris Kolpackov, 2004/05/18
- Re: need access to Makefile path,
Noel Yap <=
- Re: need access to Makefile path, Boris Kolpackov, 2004/05/18
- Re: need access to Makefile path, Noel Yap, 2004/05/18
- Re: need access to Makefile path, Boris Kolpackov, 2004/05/18
- Re: need access to Makefile path, Noel Yap, 2004/05/18
- Re: need access to Makefile path, Noel Yap, 2004/05/18
- Re: need access to Makefile path, Boris Kolpackov, 2004/05/18
- Re: need access to Makefile path, Noel Yap, 2004/05/18
- Re: need access to Makefile path, Boris Kolpackov, 2004/05/18
- Re: need access to Makefile path, Noel Yap, 2004/05/18
- Re: need access to Makefile path, Boris Kolpackov, 2004/05/18