Ninja is a small build system with a focus on speed. It takes as input the interdependencies of files (typically source code and output executables) and orchestrates building them, quickly.
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. The generator program (like the ./configure found in autotools projects) can analyze system dependencies and make as many decisions as possible up front so that incremental builds stay fast.
This is free and open source software.
Key Features
- Fast.
- Aims to be an assembler.
- Contains the barest functionality necessary to describe arbitrary dependency graphs. Its lack of syntax makes it impossible to express complex decisions.
- Build files are human-readable.
- Low-level approach makes it perfect for embedding into more featureful build systems.
- Special support for discovering extra dependencies at build time, making it easy to get header dependencies correct for C/C++ code.
- A build edge may have multiple outputs.
- 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.
- Output directories are always implicitly created before running the command that relies on them.
- 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.
- 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.
- 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.
Website: ninja-build.org
Support: Manual, GitHub Code Repository
Developer: Evan Martin and contributors
License: Apache License 2.0
Ninja is written in C++. Learn C++ with our recommended free books and free tutorials.
Related Software
| Build Systems | |
|---|---|
| Cargo | Rust package manager |
| gulp | Toolkit to automate & enhance your workflow |
| Bazel | Build and test your multi-language, multi-platform projects |
| Apache Maven | Build automation tool used primarily for Java projects |
| Gradle | Build tool with a focus on build automation and support for multi-language |
| Meson | Next-generation build system |
| CMake | Family of tools designed to build, test and package software |
| Buck2 | Encourages the creation of small, reusable modules |
| Leiningen | Automating Clojure projects |
| Grunt | JavaScript Task Runner |
| Ninja | Small build system with a focus on speed |
| xmake | Cross-platform build utility based on Lua |
| SCons | Software construction tool |
| Pants | Scalable build system for monorepos |
| PHing | Build system based on Apache Ant |
| Rake | make-like build utility for Ruby |
| Apache Ant | Tool for automating software build processes |
| Cabal | Common Architecture for Building Applications and Libraries |
Read our verdict in the software roundup.
| Alternatives to make | |
|---|---|
| CMake | Build system generator |
| SCons | Software construction tool |
| Maven | Build automation tool used primarily for Java projects |
| Premake | Simple build configuration |
| Ninja | Small build system with a focus on speed |
| just | Save and run project-specific commands |
| pdpmake | Public domain implementation of make which follows the POSIX standard |
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

