CPU

Ninja – small build system

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
CargoRust package manager
gulpToolkit to automate & enhance your workflow
BazelBuild and test your multi-language, multi-platform projects
Apache MavenBuild automation tool used primarily for Java projects
GradleBuild tool with a focus on build automation and support for multi-language
MesonNext-generation build system
CMakeFamily of tools designed to build, test and package software
Buck2Encourages the creation of small, reusable modules
LeiningenAutomating Clojure projects
GruntJavaScript Task Runner
NinjaSmall build system with a focus on speed
xmakeCross-platform build utility based on Lua
SConsSoftware construction tool
PantsScalable build system for monorepos
PHingBuild system based on Apache Ant
Rakemake-like build utility for Ruby
Apache AntTool for automating software build processes
CabalCommon Architecture for Building Applications and Libraries

Read our verdict in the software roundup.

Alternatives to make
CMakeBuild system generator
SConsSoftware construction tool
MavenBuild automation tool used primarily for Java projects
PremakeSimple build configuration
NinjaSmall build system with a focus on speed
justSave and run project-specific commands
pdpmakePublic domain implementation of make which follows the POSIX standard

Best Free and Open Source Software 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.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments