help-make
[Top][All Lists]
Advanced

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

Re: Can a makefile identify itself?


From: John Graham-Cumming
Subject: Re: Can a makefile identify itself?
Date: Thu, 18 Aug 2005 10:31:49 +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

lists wrote:
/prog/Makefile
/prog/apples/Makefile.mk

The /prog/Makefile uses "include apples/Makefile.mk" to call another makefile. I need the apples/Makefile.mk to know where it is. If I use $(shell pwd) I get the location of the root Makefile instead. I'm using Make 3.79.1 (and am stuck with it) so I can't use the MAKEFILE_LIST variable.

Is there a nice way of doing this?

You could always do this:

/prog/Makefile

    INCLUDED = apples/Makefile.mk
    include $(INCLUDED)

/prog/apples/Makefile.mk

    Use $(INCLUDED) to determine what Makefile this is.  Since you
    probably need it to not change do something like:

    I_AM := $(INCLUDED)

    as the first line.

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
POPFile: http://getpopfile.org/

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

PGP key: http://www.jgc.org/pgp/

LinkedIn: https://www.linkedin.com/profile?viewProfile=&key=1906611




reply via email to

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