[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: __FILE__
From: |
Boris Kolpackov |
Subject: |
Re: __FILE__ |
Date: |
Thu, 21 Aug 2003 17:35:36 +0000 (UTC) |
User-agent: |
nn/6.6.5+RFC1522 |
Noel Yap <address@hidden> writes:
> define _include-makefile
> __FILE__.pre-$(1) := $(__FILE__)
> __FILE__ := $(1)
> include $(1)
> __FILE__ := $(__FILE__.pre-$(1))
> endef
>
> include-makefile = $(eval $(call _include-makefile,$(1)))
>
> Then one can do:
> # GNUmakefile
> $(call include-makefile,make/GNUmine.mk)
>
> ...
>
> Does anyone see any problems with the above?
Yep, if you include the same file more than once recursively then
the '__FILE__.pre-$(1)'-based approach won't be able to restore
previous path.
I've been using basically the same technique (plus fix for the problem
mentioned above) for a while now. It works pretty well. Also with this
approach you get the ability to create makefile-local variables.
I you are interested I can email you my implementation.
hth,
-boris
--
Boris Kolpackov address@hidden http://kolpackov.net
3072R/AE084F1D - F608 942F 312E D82E 5B84 0407 C880 290B AE08 4F1D
- __FILE__, Noel Yap, 2003/08/20
- Re: __FILE__,
Boris Kolpackov <=
- Re: __FILE__, Markus Mauhart, 2003/08/22