help-make
[Top][All Lists]
Advanced

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

Re: __FILE__


From: Markus Mauhart
Subject: Re: __FILE__
Date: Fri, 22 Aug 2003 10:15:58 +0200

"Noel Yap" <address@hidden> wrote ...
>
> I know this has been discussed before.  For those not familiar with it,
> __FILE__ as an implicit file-local variable has been proposed to allow
> modular recursive inclusion of makefiles.
>
> Although I think this would be a great addition, I don't want to fight this 
> battle :-)
>
> Rather, I was wondering if the following would be a decent substitute.
>
> 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)
>
> # make/GNUmine.mk
> $(call include-makefile,$(dir __FILE__)/GNUanother.mk)
>
> Does anyone see any problems with the above?

I dont see problems. But let us know once it behaves unexpected.

> Is '/' a valid character in a macro name?

IIRC yes: 1st it workes, 2nd the doku says it.


Regards,
Markus.







reply via email to

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