help-make
[Top][All Lists]
Advanced

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

Re: Multidirectory libraries make


From: Paul Smith
Subject: Re: Multidirectory libraries make
Date: Wed, 20 Jun 2012 17:08:40 -0400

Hi; please don't send your message multiple times to the list.

If you're not subscribed to the list then your email is moderated (to
prevent spam) and so it will wait in the moderation queue until someone
gets around to looking at it and OKing it.  Sending it more times won't
make that happen any more quickly.

If you want your email to go through directly without moderation, you
must subscribe.

On Wed, 2012-06-20 at 10:45 -0700, icegood wrote:
> Paul Smith-20 wrote:
> > 
> > I don't understand why you have $(sublibraries) as targets.  Just make
> > the rule to build the actual library invoke the sub-make:
> > 
> > all: $(currlib) 
> > $(real_sublibraries) :
> >         $(MAKE) "--directory=$(dir $@)" -f makefile.mak
> > $(currlib) : $(obj) $(real_sublibraries)
> >         ar -cqs $@ $(obj) 2>/dev/null
> > 
> > Untested obviously.
> > 
> > 
> It tested and tested for a couple of years :) With targeting of
> real_sublibraries you'll obtain make that will build not all time namely
> when bar depends on obj in F(bar) directory - foo doesn't know about such
> change. It's just compares date of libbar.a with own one and decides do
> nothing! While dependance on  $(sublibraries) works well.
> The key is $(sublibraries) is .PHONY depended.
> On other hand if i simply would do $(real_sublibraries)  to be  .PHONY
> depended then foo will rebuild always.

OK, then you're trying to cheat at declaring dependencies.  If
$(currlib) depends on some object in a different directory bar, then it
should depend on THAT (that is, the "obj" variable should contain the
path to that object file) and not depend on the library in bar.

Then make the directories order-only prerequisites:

        .PHONY: $(sublibraries)
        $(sublibraries) : 
               $(MAKE) "--directory=$@" -f makefile.mak
        
        $(currlib) : $(obj) | $(sublibraries)
                ar -cqs $@ $(obj) 2>/dev/null

Now all the sublibraries rules will be done before $(currlib) is built,
but it won't cause $(currlib) to be rebuilt.




reply via email to

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