4 ms·
I really like GNU Make because it has a hidden superpower: the "-j" parameter enables instant, easy parallelization. I have a project with many subprojects and
by hathawsh 3y ago
I really like GNU Make because it has a hidden superpower: the "-j" parameter enables instant, easy parallelization. I have a project with many subprojects and I use "-j16" to invoke the same command in all of the subprojects, 16 at a time. It saves a lot of time and it works for all commands that don't touch other subprojects.
Like you, I use Make as a front end to lower level build tools. It seems to fit that role well.
- ttyprintk 3y ago‘-j -l $MAXLOAD’ is even more polite on shared systems. Avoids most runaways, but not all.
- maccard 3y agoI think this is a great example of tools being stuck in the 90's, actually. Make should be parallel by default. I get it, I do. I know there's all sorts of legacy reasons, but my 4k resolution screen with 12GB vram and 32 cores still runs make build serially, outpitx to an 80x24 window and is bottlenecked down by stdout flushing, all because we can't change defaults.
- stouset 3y agoAnd annoyingly, I don’t think there’s a way to tell `make` that a particular `Makefile` should be built with multiple threads by default. So you have to specify `-j` every time.
- maccard 3y agoYep. If it was opt-in in a per-makefile way, it would be ok (or preferably opt-out). I think cmake got this absolutely right, fwiw. You define the version of cmake you're writing against, and they go to great pains to ensure that they preserve behaviour even in newer versions of cmake. As an example, we could have a special variable: make_ver = 4.5 And even running with a future version of make the behaviour would be that of 4.5. if it's not present, it defaults to the latest version before the versions were introduced. This would let make do things like accept spaces instead of tabs, be parallel by default, etc in future versions while presenting old behaviour.