[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/
> ...
> 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.


Boris Kolpackov  address@hidden
3072R/AE084F1D - F608 942F 312E D82E 5B84  0407 C880 290B AE08 4F1D

reply via email to

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