makefile with multiple jobs -j and subdirectories -


imagine have make file subdirectories built using "make -c". image have 4 target directories. 3 out of 4 done, 1 needs run. run overall makefile with:

 make -j 4 

is there way tell makefile system run remaining target make -c -j 4 instead of 1 ? if 2 targets missing make -c -j 2 each one.

i'll expand on beta's (correct) answer. individual make processes communicate each other , guarantee there never more n jobs running across different make invocations, when use -jn. @ same time, guarantee (assuming there @ least n jobs can possibly run across make invocations), n jobs running.

suppose instead had 4 directories "something do", somehow know priori, , instead of invoking 1 instance of make -j4 , letting make invoke 4 submakes normally, force each of submakes invoked -j1. suppose first directory had 10 targets out of date, second had 5, third had 20, , fourth had 100 out of date targets. @ first have 4 jobs running in parallel. once second directory's 5 targets built, have 3 jobs running in parallel, 2, rest of build of fourth directory you'll have 1 target being built @ time , no parallelism. that's less good.

the way gnu make works, instead, 4 instances of make communicating. when second directory done, jobs running available other directories, etc. end of build fourth directory building 4 jobs @ time in parallel. that's more good.

maybe if explained why want this, more helpful in constructing answer.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -