3 ms·
"ninja" seems to refer to this: https://martine.github.io/ninja/ https://martine.github.io/ninja/ Can anyone summarise the benefits of this build system vs mak
by rwmj 11y ago
"ninja" seems to refer to this:
https://martine.github.io/ninja/ https://martine.github.io/ninja/
Can anyone summarise the benefits of this build system vs make? According to the manual, just speed (why didn't they just work on making "make" faster?)
- slavik81 11y agoThe Ninja manual introduction explains some of that. http://martine.github.io/ninja/manual.html http://martine.github.io/ninja/manual.html The short answer is that Ninja is conceptually similar to Make, but it dropped slow features to speed things up.
- evmar 11y agoThe post (quoted above in a comment) describes some of the features the Android engineers liked. This old post from when Ninja was first released discusses "why not just improve make": http://neugierig.org/software/chromium/notes/2011/02/ninja.html http://neugierig.org/software/chromium/notes/2011/02/ninja.h... With another four years of perspective, I think the things Ninja does could not have been added to make without forking Make (perhaps even the build file syntax), at which point there's little point in starting with the Make code. For example Ninja builds in parallel by default (like the -j flag to Make); you couldn't make that change in Make because existing users have builds that don't work in parallel. (Disclaimer: Ninja author, no involvement in the Android work.)
- rwmj 11y agoYou could just set MAKEFLAGS=-j<N> in the environment. I have this in my .bash_profile: export MAKEFLAGS=-j$((`nproc` + 1))
- reubenmorais 11y agoAs evmar already mentioned, lots of projects don't support parallel make.
- reubenmorais 11y agoThis paper has a lot of great information: http://aegis.sourceforge.net/auug97.pdf http://aegis.sourceforge.net/auug97.pdf Basically, the way most projects use make (recursive make) creates a whole lot of problems. This can be fixed while still using make, but if you're already revamping your entire build system, you might as well move to something that offers additional niceties like the ones mentioned in the article: better error messages, progress report, machine readable output, etc.
- deleted 11y ago[deleted]
- wnissen 11y agoI like this: "Ninja buffers the output of each command and prints it without mixing output from multiple commands, meaning error messages will be printed as a group after a build failure, and not mixed with other concurrent build output."
- rspeer 11y agoTo me, the most important feature of Ninja is that it can still track dependencies when a command produces multiple output files. In Make, if you have a step with multiple outputs, it seems the usual thing to do is to lose track of all but one of them, and instruct the developer to run "make clean" when things stop working.