LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ninja

small, fast build system

TLDR

Build project
$ ninja
copy
Build specific target
$ ninja [target]
copy
Build with multiple jobs
$ ninja -j [8]
copy
Build in a different directory
$ ninja -C [build_dir]
copy
Clean build
$ ninja -t clean
copy
Dry run
$ ninja -n
copy
Verbose output
$ ninja -v
copy
Keep going after errors
$ ninja -k [0]
copy
Use specific build file
$ ninja -f [build.ninja]
copy
Show build graph
$ ninja -t graph [target]
copy

SYNOPSIS

ninja [options] [targets]

DESCRIPTION

ninja is a small, fast build system closest in spirit to Make. It focuses on speed and correctness, taking a different approach by having its input files be generated by a higher-level build system rather than written by hand.Build files (build.ninja) are typically generated by CMake, Meson, or GN. Ninja was designed to replace Make as the build executor for large projects like Chromium.

PARAMETERS

TARGETS

Build targets.
-j N
Run N jobs in parallel (0 means infinity) [default=number of CPUs].
-f FILE
Specify input build file [default=build.ninja].
-C DIR
Change to DIR before doing anything else.
-v
Show all command lines while building.
-n
Dry run (don't run commands but act like they succeeded).
-k N
Keep going until N jobs fail (0 means infinity) [default=1].
-l N
Do not start new jobs if the load average is greater than N.
-t TOOL
Run a subtool (use -t list to list subtools).
-d MODE
Enable debugging (use -d list to list modes).
-w FLAG
Adjust warnings (use -w list to list warnings).
--version
Print ninja version.
--help
Display help information.

CAVEATS

Build files are not typically hand-written but generated by a meta-build system. Ninja has minimal features compared to Make by design. Default parallelism is based on the number of available CPUs.

HISTORY

Ninja was created by Evan Martin at Google for building Chrome, released in 2012.

SEE ALSO

cmake(1), meson(1), make(1)

Copied to clipboard
Kai