help-make
[Top][All Lists]
Advanced

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

Re: how to reference the directory where current Makefile resides ?


From: Eli Zaretskii
Subject: Re: how to reference the directory where current Makefile resides ?
Date: Sat, 19 May 2007 10:45:21 +0300

> Date: Sat, 19 May 2007 10:34:08 +0300
> From: "Yakov Lerner" <address@hidden>
> 
> How can I reference the directory where the currently executed Makefile
> resides (like what $(dirname $0) is in bash ) ?

Does ${CURDIR} do what you want?

> Here is what I am trying to do:
> 
> 1. In the same dir of Makefile, there is a "submakefile" that I need to
> include ("include submakefile").
> 
> 2. When my cwd is same where Makefile resides, then no problem:
> 'include submakefile' works.
> 
> 3. But when I am in different dir, then make does not find the
> submakefile. Is there any builtin variable for the directory of
> the current Makefile (like `dirname $0` in shell) ?, so I can write
> something line
>            include $(DIR_OF_MAKEFILE)/submakefile
> ?

If CURDIR is not what you want, perhaps this will:

  DIR_OF_MAKEFILE := $(shell pwd)




reply via email to

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