[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multi-architecture builds and recursive makes
From: |
Paul D. Smith |
Subject: |
Re: multi-architecture builds and recursive makes |
Date: |
Thu, 17 Jun 2004 15:48:38 -0400 |
%% "Robert P. J. Day" <address@hidden> writes:
rpjd> i'm reading paul smith's essay on multi-architecture builds
rpjd> (http://make.paulandlesley.org/multi-arch.html), but it seems
rpjd> that that approach wouldn't work if one had a recursive make
rpjd> structure, would it?
Sure.
rpjd> that is, say one had the source directory SRCDIR and the
rpjd> directory in which to build the objects OBJDIR, the *general*
rpjd> form of the make invocation would be (simplified drastically for
rpjd> brevity):
rpjd> $ cd ${SRCDIR}
rpjd> $ make -C ${OBJDIR} -f ${SRCDIR}/Makefile <target>
rpjd> that would work fine for simple targets, but if the Makefile had
rpjd> a recursive structure that tried to "make" into SRCDIR's
rpjd> subdirectories, it seems this would fail as the make (running
rpjd> effectively in OBJDIR) would try to locate the subdirectories in
rpjd> OBJDIR, not SRCDIR, would fail to find them, and abort, no? (a
rpjd> quick test seems to verify this behaviour.)
No...
The model is this: you run the make in the source directory. That is
sort of the "master" make. It will invoke a sub-make in the target
directory in order to build all the local targets.
_BUT_, that sub-make doesn't try to build any subdirectories. Instead,
once the sub-make is done building the local targets it exits. Then
it's up to the parent make (in the source directory) to run any
sub-makes.
In short, you want to put any recursion into the section of the makefile
that's invoked in the source directory, not the section invoked in the
target directory.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist