help-make
[Top][All Lists]
Advanced

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

Multidirectory libraries make


From: icegood
Subject: Multidirectory libraries make
Date: Wed, 20 Jun 2012 01:00:57 -0700 (PDT)

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.

So, everything works great in serial mode. libfoo.a created only if libbar.a
ACTUALLY updated and if it needed to update it firstly really UPDATED
accordingly to .PHONY target  bar and bar target is written just before
$(currlib) target.
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?

-- 
View this message in context: 
http://old.nabble.com/Multidirectory-libraries-make-tp34041256p34041256.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.


reply via email to

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