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 08:18:40 -0400

On Wed, 2012-06-20 at 01:01 -0700, icegood wrote:
> Hi there!
> I'm trying to create a tree of makefiles of creatinf static libraries each
> of which respond to own directory. Diectories are depend on each other and
> will re-made only when it needed. To do this i've created a pattern:
> common_lib.mak:
> currlib:=lib$(library).a
> real_sublibraries:=$(foreach pth,
> $(sublibraries),$(common)/$(pth)/lib$(notdir $(pth)).a)
> .PHONY: all $(sublibraries)
> all: $(sublibraries) $(currlib) 
> $(sublibraries) :
>     $(MAKE) "--directory=$@" -f makefile.mak; 
> $(currlib) : $(obj) $(real_sublibraries)
>   ar -cqs $@ $(obj) 2>/dev/null;
> 
> and each library has only dependency variables i.e.
> makefile.mak:
> library:=foo
> sublibraries:=bar
> include $(common)/common_lib.mak
> 
> variables $(common) $(MAKE) are imported from Main Makefile.
> 
> But it doesn't work well in parallel mode: it checks that $(currlib)
> actually doesn't depend on bar  and could execute it firstly before bar 
> executed, so it dealth with old version of libbar.a.
> How to overcome it in parallel mode?

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.




reply via email to

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