help-make
[Top][All Lists]
Advanced

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

Re: Querying the name of the current makefile


From: John Graham-Cumming
Subject: Re: Querying the name of the current makefile
Date: Mon, 03 Apr 2006 17:38:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Greg Chicares wrote:
Is there any way to determine the name of the current makefile?

Try

    THIS_MAKEFILE := $(words $(word $(MAKEFILE_LIST)),$(MAKEFILE_LIST))

Or if you are using GNU Make 3.81:

    THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))

Note that you must do this _before_ any 'include' statement in the Makefile otherwise THIS_MAKEFILE will be incorrect.

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
Blog: http://www.jgc.org/blog/

POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/




reply via email to

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