3 ms·
The Ninja build system v1.10.0, Jan 2020
- peter_d_sherman 7y agoExcerpt: Comparison to Make "Ninja is closest in spirit and functionality to Make, relying on simple dependencies between file timestamps. But fundamentally, make has a lot of features: suffix rules, functions, built-in rules that e.g. search for RCS files when building source. Make’s language was designed to be written by humans. Many projects find make alone adequate for their build problems. In contrast, Ninja has almost no features; just those necessary to get builds correct while punting most complexity to generation of the ninja input files. Ninja by itself is unlikely to be useful for most projects. Here are some of the features Ninja adds to Make. (These sorts of features can often be implemented using more complicated Makefiles, but they are not part of make itself.) o Ninja has special support for discovering extra dependencies at build time, making it easy to get header dependencies correct for C/C++ code. o A build edge may have multiple outputs. o Outputs implicitly depend on the command line that was used to generate them, which means that changing e.g. compilation flags will cause the outputs to rebuild. o Output directories are always implicitly created before running the command that relies on them. o Rules can provide shorter descriptions of the command being run, so you can print e.g. CC foo.o instead of a long command line while building. o Builds are always run in parallel, based by default on the number of CPUs your system has. Underspecified build dependencies will result in incorrect builds. o Command output is always buffered. This means commands running in parallel don’t interleave their output, and when a command fails we can print its failure output next to the full command line that produced the failure."