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
|