On Sun, May 19, 2013 at 09:45:22PM +0400, Vadim Zhukov wrote: > > 2013/5/19 David Coppa <[1][email protected]> > > On Sun, May 19, 2013 at 4:33 PM, Vadim Zhukov <[2][email protected]> > wrote: > > Hello all. > > > > This patch allows to run parallel builds for CMake-based ports. > > Yes, it works. At least, for me. :) Tested on a few KDE4 ports. > > So cool! > But what is the rationale behind this? > > It's all about handling recursive make calls. Any parallel-ready > make(1) implementation knows that recursive calls should not be > parallelized, at least simply. But they use different mechanisms to > avoid this problem. > GNU Make have separate mechanism to talk with sub-makes. It's > complicated but works for most time. Thus there was not needed anything > to add in Makefile.
When we did our parallel make, we decided against gnu-make's mechanism for various reasons. One of the most important one being that it's brittle: it relies on some env variables/fd passing unchanged through a few layers (shell) between two gmake. I gather that's also one of the reasons for gmake -C: directly doing "gmake -C dir target" avoids the intermediate shell inherent to cd dir && gmake target So, every parallel make uses big kludges to avoid run-away recursion. Ours is simpler than most, and works surprisingly well. ;)
