On 5/19/07, Yakov Lerner <[EMAIL PROTECTED]> wrote:

How can I reference the directory where the currently executed Makefile
resides (like what $(dirname $0) is in bash ) ?


It sounds like you could use MAKEFILE_LIST inside Makefile:

makefileDir := $(dir $(firstword $(MAKEFILE_LIST)))

MAKEFILE_LIST contains the paths of all makefiles read (in order) during
make's invocation.  The above won't quite work, though, if someone causes a
different file to be included before the Makefile you specified:

   make -f otherdir/preMakefile  -f Makefile

In this case, the above would echo 'otherdir/', not './' like I expect you
want.

--
Shawn Halpenny
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to