help-make
[Top][All Lists]
Advanced

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

Re: Compiling Link dependent targets in parallel


From: Paul Smith
Subject: Re: Compiling Link dependent targets in parallel
Date: Sat, 15 Oct 2022 11:02:57 -0400
User-agent: Evolution 3.46.0 (by Flathub.org))

On Fri, 2022-10-14 at 17:50 +0530, shubham sharma wrote:
> Currently for link dependent targets, say if A depends on B, for A to
> start compiling the compilation and linking of B has to be completed
> first.  But given that compilation of both the targets is independent
> of each other, isn't there a way where A and B compile in parallel
> and this wait happens only at Link Time. i.e
> 
> -> A's compilation starts
> -> B's compilation starts (in parallel)
> -> if A finishes first it waits for B to finish(for linking), but if
> B finishes first A doesn't have to wait

Sorry but I don't understand the question.  You say "for A to start
compiling ... B has to be completed" but then you say "the compilation
of both targets is independent".  Both of those cannot be true.

It seems you might be confusing compiling and linking, which are two
different steps.  If you create A by linking a bunch of object files
plus B (say B is a shared library or whatever), and you create B by
linking a bunch of object files, then of course you can (and make will)
compile all the object files in parallel before linking B, then A. 
That's the whole point of parallel builds.

Are you perhaps doing all the compiling and linking in a single rule? 
That cannot work well if you want to create a parallel environment.

Perhaps if you provided an example of a makefile that does not do what
you want we can help.



reply via email to

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