Ninja (build system)

Short description: Free build automation software

Ninja

Ninja being used to compile dav1d, in conjunction with Meson configuration

Developer(s)| Evan Martin
Initial release| 2012; 14 years ago (2012)[1]
Stable release|

1.11.0[2] / May 15, 2022; 3 years ago (2022-05-15)

Written in| C++, Python
Operating system| Linux, macOS, Windows
Type| Software development tools
License| Apache License 2.0[3]

Ninja is a small build system developed by Evan Martin,[4] a Google employee. Ninja has a focus on speed and it differs from other build systems in two major respects: it is designed to have its input files generated by a higher-level build system, and it is designed to run builds as fast as possible.

## Contents

* 1 Build system
* 2 Example
* 3 References
* 4 External links

## Build system

In essence, Ninja is meant to replace Make, which is slow when performing incremental (or no-op) builds.[5] This can considerably slow down developers working on large projects, such as Google Chrome which compiles 40,000 input files into a single executable. In fact, Google Chrome is a main user and motivation for Ninja.[6] It's also used to build Android (via Makefile translation by Kati),[7] and is used by most developers working on LLVM.[8]

In contrast to Make, Ninja lacks features such as string manipulation, as Ninja build files are not meant to be written by hand. Instead, a "build generator" should be used to generate Ninja build files. Gyp, CMake, Meson, and gn[9] are popular build management software tools which support creating build files for Ninja.[10]

## Example

rule cc
command = gcc -c -o $out $in
description = CC $out

rule link
command = gcc -o $out $in
description = LINK $out

build source1.o: cc source1.c
build source2.o: cc source2.c
build myprogram: link source1.o source2.o

## References

1. ↑ Martin, Evan. "Google Groups: ninja-build". https://groups.google.com/forum/#!searchin/ninja-build/release|sort:date/ninja-build/wtfGmg0IoXQ/eH_tgL8eF8YJ. Retrieved 18 June 2017.
2. ↑ "Releases - ninja-build/ninja". https://github.com/ninja-build/ninja/releases. Retrieved 20 June 2022.
3. ↑ "COPYING". https://github.com/ninja-build/ninja/blob/master/COPYING. Retrieved 5 September 2019.
4. ↑ "Google man open sources Chrome build system". https://www.theregister.com/2011/02/08/google_ninja_build_system_open_sourced/.
5. ↑ Röthlisberger, David. "The Ninja build tool". https://lwn.net/Articles/706404/. Retrieved 18 June 2017.
6. ↑ "Ninja". http://www.aosabook.org/en/posa/ninja.html. Retrieved 18 June 2017.
7. ↑ "aosp mailing list". https://groups.google.com/forum/#!topic/android-platform/Hhl_4hfOONg/discussion.
8. ↑ "LLVM documentation". https://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary.
9. ↑ "gn - Git at Google". https://gn.googlesource.com/gn/.
10. ↑ Kitware. "cmake Documentation". https://cmake.org/cmake/help/v3.8/generator/Ninja.html. Retrieved 18 June 2017.

## External links

* Official Website
* on GitHub

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Ninja (build system). Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Ninja_(build_system)&oldid=779088"