Hacker News new | ask | show | jobs
by wonsler 4096 days ago
A Ninja file is probably no easier to write than a Makefile. But Ninja is a lot faster than make, which is the reason for using it. To see this, configure Chromium to build with Xcode, make, and ninja, and compare the build times.
2 comments

Adding to this, from what I understand, ninja was designed to be generated by another more feature-full build tools. For example in chromium, its generated from gyp (generate your projects) files. The fact that its human readable is just a plus.

Makefiles I presume, will be hard to write by hand when:

1. Your project code base is large 2. It take large amount of time or very powerful machines to build sub-modules (V8 for e.g in chromium) so, you don't want to do it all the time 3. Conditional inclusion of sub-modules (for iOS vs Android if you have two separate set of files etc) 4. Sub-modules are pulled in from 3rd parties into your code base

I once wrote a custom build systems in python to generate Make files. I did this because I wanted to use convention instead of configuration and achieve fast builds on multicore machines. Later, after leaving that company, I wanted to recreate a similar build system. I wrote it in python to generate Ninja build files. I found it easier and cleaner to write Ninja build files.

I wasn't able to do a direct comparison of the build speeds of the two systems, but I bet the Ninja builds were significantly faster.