help-make
[Top][All Lists]
Advanced

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

Re: Question about recursive make


From: John Calcote
Subject: Re: Question about recursive make
Date: Fri, 22 May 2009 19:32:09 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2

Hi Paul,

On 5/22/2009 4:01 PM, Paul Smith wrote:
On Fri, 2009-05-22 at 16:24 -0500, Erik Lotspeich wrote:
  
I have a question about recursive make.  I have the FSF GNU Make book by
Richard Stallman & Roland McGrath (covering Make version 3.77).  In this
book, it describes the following as equivalent:

cd dirname && $(MAKE)
$(MAKE) -C dirname

It seems that these are not equivalent, however.  When integrating a
Makefile system with the Linux Kernel build system, these two forms have
different effects.  The first form works; the second form doesn't.
    

They are equivalent.  You never explain what "doesn't work" about the
second form so there's no way we can help you.
  
He does explain, though not very clearly. I think his problem is that when using the shell-based form of make invocation, his output files are left in the current directory, but when using the -C command-line option, his output files are left in the top-level directory.

As Sam Ravnborg stated in another answer, the problem is that $(MAKE) -C doesn't reinvoke make via the shell, so the value of PWD is simply propagated from the top level down. When he invokes make via the shell, the shell gives him a new version of PWD for each directory.

Regards,
John

reply via email to

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