help-make
[Top][All Lists]
Advanced

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

Re: multi-architecture builds and recursive makes


From: Robert P. J. Day
Subject: Re: multi-architecture builds and recursive makes
Date: Thu, 17 Jun 2004 11:05:50 -0400 (EDT)

On Thu, 17 Jun 2004, bertold wrote:

> Robert P. J. Day wrote:
> 
> >  i'm reading paul smith's essay on multi-architecture builds
> >(http://make.paulandlesley.org/multi-arch.html), but it seems that that 
> >approach wouldn't work if one had a recursive make structure, would it?
> >
> >  that is, say one had the source directory SRCDIR and the directory in
> >which to build the objects OBJDIR, the *general* form of the make
> >invocation would be (simplified drastically for brevity):
> >
> >  $ cd ${SRCDIR}
> >  $ make -C ${OBJDIR} -f ${SRCDIR}/Makefile <target>
> >
> >that would work fine for simple targets, but if the Makefile had a
> >recursive structure that tried to "make" into SRCDIR's subdirectories, it
> >seems this would fail as the make (running effectively in OBJDIR) would
> >try to locate the subdirectories in OBJDIR, not SRCDIR, would fail to find
> >them, and abort, no?  (a quick test seems to verify this behaviour.)
> >
> >  i have a couple followup questions about multi-arch builds, but i'll 
> >hold off until i clarify this point.  thanks.

> So, you should provide right path to sources. Actually i did
> differently. Go through source dirs and keeping path to object dir. This
> way if you have all objects in one place.

i'm not sure what you mean by "provide right path to sources."  do you 
mean that all subdirectory references in the makefile should be 
fully-qualified?  that's kind of a pain.  let me expand on this.

in your typical recursive make, you might have (stealing out of the gnu 
manual):

SUBDIRS = foo bar baz
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)

$(SUBDIRS):
        $(MAKE) -C $@

that is, when most people design their recursive make, they refer to their
subdirs by their relative names (being perfectly acceptably lazy :-).  
that works fine if the make is being done *in* that subdirectory.

but when you try to extend this to the multi-arch make and build in a 
different directory, all of these subdirectories won't be found.  my 
understanding thus far is that, while VPATH is terrific for finding 
prerequisites such as source files, object files or header files, it 
doesn't help in the case of a recursive make where the makefile wants to 
refer to immediate subdirectories.  (unless i've read this entirely 
incorrectly.  i've tried a couple test cases and this is the behaviour 
i've seen.)

but let me make things even stickier.

i want to be able to define multi-arch makes around software that i 
download off the net, and that i don't want to have to modify the 
makefiles for.  in the simple case, this is easy.  given two directories:

  src/          # downloaded software
  obj/

i can be in the parent directory of those two, and just run:

  $ make VPATH=${SRCDIR} -C obj -f ${SRCDIR}/makefile <whatever>

this appears to work fine, which is nice, since i don't want to have to 
hack the source at all.  but still, this doesn't help if the source i 
downloaded has a recursive build structure.

it also doesn't help if the source is something like the 2.4 kernel,
whose rules have commands referring to programs like "scripts/Menuconfig" 
or something like that.  that seems to make a complete mess of a 
multi-arch build, and it's something VPATH doesn't help with.

  anyway, i'm sure i'm trying to push the idea of VPATH and multi-arch 
builds way further than it was designed to go.  i just wanted to verify 
that the limitations i've run into are really limitations, and not just
based on my misunderstanding of the docs.

rday




reply via email to

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