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:
.PHONY: all $(sublibraries)
all: $(sublibraries) $(currlib)
$(MAKE) "--directory=$@" -f makefile.mak;
$(currlib) : $(obj) $(real_sublibraries)
ar -cqs $@ $(obj) 2>/dev/null;
and each library has only dependency variables i.e.
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
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?