Ninja is a small, extremely fast build system originally created by Google, tied for the #37 most-used build tool in developer surveys at roughly 5.2% usage share. Unlike Make, Ninja isn't meant to be written by hand โ other build systems like CMake generate its build.ninja files for you. It's used because it's optimized purely for the speed of incremental rebuilds, which matters enormously in huge C/C++ codebases like Chromium and LLVM.
A minimal hand-written build.ninja file showing a rule and a build edge โ in practice, CMake or GN would generate this for you automatically.
# build.ninja
rule cc
command = gcc -c $in -o $out
description = Compiling $in
build main.o: cc main.c
build app: link main.o
command = gcc main.o -o app
Most developers never invoke Ninja directly โ they generate the build files with CMake, then let Ninja execute them.
# install Ninja (or via apt/brew/choco)
pip install ninja
# tell CMake to generate Ninja build files instead of Makefiles
cmake -G Ninja -S . -B build
# run the fast incremental build
ninja -C build