bug-make
[Top][All Lists]
Advanced

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

[bug #38437] cannot find the include file


From: Jian
Subject: [bug #38437] cannot find the include file
Date: Thu, 28 Feb 2013 08:35:30 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22

Follow-up Comment #2, bug #38437 (project make):

(just paste the mail with solution here for your reference)

Thanks Philip. It works for me, and now I can distribute my makefiles into
different path.

However, I still hope it can be improved as the expreience of C/C++ tells us
it shall be able to. When reading a makefile, the path of this file should be
added into the search path automaticallly.



2013/2/28 Philip Guenther <address@hidden>
On Wed, Feb 27, 2013 at 8:55 PM, Jian <address@hidden> wrote:
...
> Supposing 2 makefiles in dir A: 1.mak, 2.mak, and 1.mak include 2.mak.
> Now in dir B, 3.mak includes 'A/1.mak' (will auto include 2.mak). But error
> shows that 2.mak cannot be found.
>
> The make option "-I" can be the workaround like:
>  cd B
>  make -f 3.mak -IA
>
> But it's not acceptable to tell user to uses "-I" to make every time. make
> shall be able to find 2.mak.

So have 1.mak look for 2.mak in the same directory, by doing something like:

# Get the directory part of the path by which 1.mak was included
# This should be before any other includes in 1.mak
dir_of_1 = $(dir $(lastword $(MAKEFILE_LIST)))

...and then later:

# pull in 2.mak in the same directory as this file
include ${dir_of_1}2.mak

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38437>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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