[Top][All Lists]

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

Re: Link called only if all other actions are completed

From: Paul Smith
Subject: Re: Link called only if all other actions are completed
Date: Fri, 8 Oct 2010 13:39:34 -0400

On Fri, 2010-10-08 at 18:24 +0200, Erik Rull wrote:
> What happens: all .o's get compiled and only then the linking elements get 
> executed one after another (and not simultaneously!). None of the targets 
> share .o files.
> What I would expect: after all .o's of one target are completed the linker 
> of this target should get executed.

I'm pretty sure make is doing the right thing.  The only way I would be
convinced that something is wrong is if you could show a situation where
there are not 5 outstanding jobs at the same time, but there is still
work left to do that could be done in parallel.

I suspect it's only doing the links one at a time because the subsequent
links are deferred until compiles complete.  The only way you'd get >1
link running at the same time would be is that two .so files had all
their .o's finish building at the same time, so there was no more work
left to do.  That's pretty unlikely, actually, since they have different
#'s of .o's as prerequisites, etc.

So in your example:

> file1.o file2.o file3.o ...
>         $(LD) ...
> file4.o file5.o file6.o ...
>         $(LD) ...

Make will start 5 jobs immediately:

        file1.o file2.o file3.o file4.o file5.o

Every time a job slot comes free, make will continue building .o's until
all three of the first .o's (file1.o, file2.o, file3.o) complete, then
it will run the link for with the next available job slot.
Similarly, once all the prerequisites of complete it will
build that, but in the meantime it's still building .o's for
other .so's.


reply via email to

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