This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Understanding Multilibs ;-)

On Jul 28, 2003, (Nathanael Nerode) wrote:

> So, I decided to take a crack at moving multilibbing to the top level.

Wheee! :-)

> What I'm getting confused by at first is how the list of multilibs is 
> generated. configures only the multilibs that are deemed valid.
Then, the Makefile stub that goes in every library's top Makefile
iterates over all multilibs the compiler knows about, skipping those
whose directories don't exist (assuming they aren't there because they
weren't configured)

If you're to move this logic to the top level, make sure you follow
the logic in, and not the simplified logic that adds to the primary multilib of every target lib (that we
want to get rid of in this process, right?)

Also, beware of some problems you'll run into:

- Ideally, we'd like to have Makefile dependencies in the top level
  for every combination of library/mutlilib, such that we could do
  something like `make all-target-<multilib>-libstdc++-v3, and have
  only libstdc++-v3's dependencies built for multilib.

  Unfortunately, this is very tricky to accomplish.  First, because
  you can only tell the set of multilibs after the compiler is build,
  so you'd have to change the top-level Makefile somehow while it's
  already running, i.e., you can't do it.

  The solution I've been thinking of for the past few days goes like
  this: we introduce a new Makefile in <target_alias>, that will
  contain the actual target libraries' dependencies, instantiated for
  every multilib.  We'd have a top-level Makefile target
  target-Makefile or so that would depend on all-gcc and would
  construct such a Makefile.  all-target would then depend on
  target-Makefile, and do make -C <target> all.

  We could still have all-target-<lib> in the top level, redirecting
  to target/Makefile, but it's trickier to get right, because of
  parallel makes.  We still need accurate dependencies of target
  libraries in the top level Makefile, but they must redirect to
  targets that iterate over all multilibs but that do *not* have
  dependencies.  Such targets should only be used from the toplevel
  Makefile.  The idea of not having dependencies is to make sure that,
  even though say both libstdc++ and libobjc depend on newlib, we
  don't go through newlib twice in parallel when we descend into
  target/Makefile for libstdc++ and libobjc in parallel.

Lemme try to give an example:

configure-target-Makefile: all-gcc \
  # plus dependencies to reconfigure in case the set of multilibs changes
        create or update $(target)/Makefile

all-target: all-target-Makefile
        cd $(target) && $(MAKE)

configure-target-<lib>: configure-target-Makefile
        cd $(target) && $(MAKE) configure-<lib>-nodeps
all-target-<lib>: configure-target-<lib>
        cd $(target) && $(MAKE) all-<lib>-nodeps


configure-<lib>: configure-<lib>-<multilib>...
all-<lib>: all-<lib>-<multilib>...
configure-<lib>-<multilib>: lib's configure deps for multilib
        $(MAKE) configure-<lib>-<multilib>-nodeps
all-<lib>-<multilib>: configure-<lib>-<multilib> lib's build deps for multilib
        $(MAKE) all-<lib>-<multilib>-nodeps

        mkinstalldirs $(multilib)/$(lib)
        cd $(multilib)/$(lib) && configure
        cd $(multilib)/$(lib) && $(MAKE)

configure-<lib>-nodeps: configure-<lib>-<multilib>-nodeps...
all-<lib>-nodeps: all-<lib>-<multilib>-nodeps...

all: all-<lib>...

I *think* this design should work, enabling multilibs to be configured
and built in parallel, and also to enable users to choose a select set
of multilibs to build or install, interacting with the target-specific

We'll probably need an autogen-generated Makefile fragment to which
we'd apply autoconf substitutions on a per-multilib basis.

Cool, eh? :-)

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                 aoliva@{,}
CS PhD student at IC-Unicamp        oliva@{,}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]