[jamming] Not relinking dynamic libraries when not needed (Was Re: Build foo after bar, but don't depend on it)
alenl-ml at croteam.com
Thu Apr 7 04:08:12 PDT 2005
I've been thinking of this some more and I find the problem to be even
simpler than I originally thought. But I don't see a solution.
Consider a standard dependency chain used to build a simple library made of
one source file and one header and a simple application using it:
Depends Application : Library AppObj ;
Depends Library : LibObj ;
Depends AppObj : AppCpp ;
Depends LibObj : LibCpp ;
Includes AppCpp : LibH ;
Includes LibObj : LibH ;
1) Changing LibH causes Application to be relinked, and that is ok, since
AppObj must be recompiled. That is ok.
2) If I only change LibCpp, it will recompile LibObj, and relink Library and
in turn cause relinking of Application. If this is not a static, but a
dynamic library, then it is completely unneccessary.
I want to set it up so that Application is relinked only if AppObj is
recompiled. _But_, I cannot completely remove the dependency of Application
on Library, because if both AppCpp and LibCpp are changed, or if Library
does not exist, Library _must_ be linked _before_ Application, since it is
one of its inputs.
Any ideas on how to solve this? IIRC, Benjamin Scherrey mentioned fake
targets, but I don't quite understand how that fits this situation. Any help
----- Original Message -----
From: "Alen Ladavac" <alenl-ml at croteam.com>
To: <jamming at perforce.com>
Sent: Friday, January 28, 2005 15:56
Subject: Re: [jamming] Build foo after bar, but don't depend on it
> Heh, well, the actual situation I was working on when I posted the OP is a
> bit complex to explain. (Hey, if it weren't complex, I wouldn't be using
> for it. ;) ) But, I can give some example from the everyday work that is
> usually set up a bit wrong, because this feature is missing:
> Imagine having a set of dynamic libraries and an executable (not so
> setup, right?). The libraries need to be "linked" into one another and
> the executable, in the standard dependency order. But in fact, when you
> at it, in most cases there is no need to actually perform the linking step
> at all, even if the library was changed. E.g. you have changed something
> the implementation of one library function. This will usually pull a whole
> chain of linking, without any good reason. Dynamic libraries are binary
> compatible unless you change an interface. But to change an interface, you
> need to change a .h file. If would be best to setup dependencies so that
> linking of a library is issued only if some of the dependent h files are
> changed, or if obj files of that particular library is changed. But the
> linking definitely must take place _after_ the dependent libraries.
> This is not what I needed that for, but it depicts the problem quite well
> ----- Original Message -----
> From: "Diane Holt" <holtdl at yahoo.com>
> To: "Craig Allsop" <callsop at sceptre.net>; "'Alen Ladavac'"
> <alenl-ml at croteam.com>; <jamming at perforce.com>
> Sent: Wednesday, January 26, 2005 20:49
> Subject: RE: [jamming] Build foo after bar, but don't depend on it
> > It's hard for me to say for sure, since I'm not real good with A's and
> > instead of specific examples, but pseudotargets is what comes to mind.
> > Diane
> > --- Craig Allsop <callsop at sceptre.net> wrote:
> > >
> > > Good question, if you find out, please tell.
> > >
> > > Craig.
> > >
> > > -----Original Message-----
> > > From: jamming-admin at perforce.com [mailto:jamming-admin at perforce.com]
> > > Behalf Of Alen Ladavac
> > > Sent: Tuesday, 11 January 2005 7:29 PM
> > > To: jamming at perforce.com
> > > Subject: [jamming] Build foo after bar, but don't depend on it
> > >
> > > Hi all,
> > >
> > > I've been pondering this one specific glitch that I hit constantly...
> > > don't see a way to specify that one target is to be built after
> > > one,
> > > but not depend on it.
> > >
> > > E.g. target C is built from A and B, and then E is built from C and D,
> > > but E
> > > shouldn't be rebuilt when B changes, only when A changes. In other
> > > I
> > > should specify that E depends on A and D only, not on C, but C must be
> > > built
> > > before E's build is started.
> > >
> > > Is there any way in the basic Jam to specify this, or is there some
> > > patch
> > > for this?
> > >
> > >
> > > _______________________________________________
> > > jamming mailing list - jamming at perforce.com
> > > http://maillist.perforce.com/mailman/listinfo/jamming
> > >
> > =====
> > (holtdl at yahoo.com)
> > _______________________________________________
> > jamming mailing list - jamming at perforce.com
> > http://maillist.perforce.com/mailman/listinfo/jamming
> jamming mailing list - jamming at perforce.com
More information about the jamming