• Home
  • Raw
  • Download

Lines Matching full:ninja

1 The Ninja build system
9 Ninja is yet another build system. It takes as input the
13 Ninja joins a sea of other build systems. Its distinguishing goal is
15 http://neugierig.org/software/chromium/notes/2011/02/ninja.html[my
19 after changing one file. Ninja is under a second.
24 Where other build systems are high-level languages, Ninja aims to be
32 Ninja contains the barest functionality necessary to describe
36 Instead, Ninja is intended to be used with a separate program
42 build a debug or release-mode binary?" belong in the `.ninja` file
48 Here are the design goals of Ninja:
73 generate your ninja files using another program_. This is how we
76 * built-in rules. _Out of the box, Ninja has no rules for
80 the program that generates the ninja files_.
85 To restate, Ninja is faster than other build systems because it is
86 painfully simple. You must tell Ninja exactly what to do when you
87 create your project's `.ninja` files.
92 Ninja is closest in spirit and functionality to Make, relying on
100 In contrast, Ninja has almost no features; just those necessary to get
102 ninja input files. Ninja by itself is unlikely to be useful for most
105 Here are some of the features Ninja adds to Make. (These sorts of
109 * Ninja has special support for discovering extra dependencies at build
136 Using Ninja for your project
139 Ninja currently works on Unix-like systems and Windows. It's seen the
143 If your project is small, Ninja's speed impact is likely unnoticeable.
144 (However, even for small projects it sometimes turns out that Ninja's
147 edit-compile cycle time of your project already then Ninja won't help.
150 featureful than Ninja itself. For some recommendations: the Ninja
152 in Ninja's design, and thinks https://github.com/apenwarr/redo[redo]'s
155 Ninja's benefit comes from using it in conjunction with a smarter
160 node.js), as well as Google Fuchsia. gn can generate Ninja files for
164 can generate Ninja files on Linux as of CMake version 2.8.8. Newer versions
165 of CMake support generating Ninja files on Windows and Mac OS X too.
167 https://github.com/ninja-build/ninja/wiki/List-of-generators-producing-ninja-build-files[others]::
171 Running Ninja
174 Run `ninja`. By default, it looks for a file named `build.ninja` in
184 `ninja -h` prints help output. Many of Ninja's flags intentionally
185 match those of Make; e.g `ninja -C build -j 20` changes into the
187 Ninja defaults to running commands in parallel anyway, so typically
194 Ninja supports one environment variable to control its behavior:
208 `%e`:: Elapsed time in seconds. _(Available since Ninja 1.2.)_
218 The `-t` flag on the Ninja command line runs some tools that we have
219 found useful during Ninja's development. The current tools are:
230 ninja -t browse --port=8000 --no-browser mytarget
237 ninja -t graph mytarget | dot -Tpng -ograph.png
240 In the Ninja source tree, `ninja graph.png`
241 generates an image for Ninja itself. If no target is given generate a
245 like +ninja -t targets rule _name_+ it prints the list of targets
248 +ninja -t targets depth _digit_+ it
252 +ninja -t targets depth 1+ is assumed. In this mode targets may be listed
253 several times. If used like this +ninja -t targets all+ it
263 _Available since Ninja 1.11._
272 If used like +ninja -t clean -r _rules_+ it removes all files built using
280 build file. _Available since Ninja 1.10._
287 _Available since Ninja 1.2._
290 target, show just the target's dependencies. _Available since Ninja 1.4._
305 _Available since Ninja 1.11._
307 `recompact`:: recompact the `.ninja_deps` file. _Available since Ninja 1.4._
310 file. _Available since Ninja 1.10._
313 to pass to +ninja -t targets rule _name_+ or +ninja -t compdb+. Adding the `-d`
321 ninja -t msvc -e ENVFILE -- cl.exe <arguments>
333 ninja -t msvc -o DEPFILE [-p STRING] -- cl.exe /showIncludes <arguments>
342 Note that Ninja supports this natively now, with the use of `deps = msvc` and
343 `msvc_deps_prefix` in Ninja files. Native support also avoids launching an extra
347 `wincodepage`:: Available on Windows hosts (_since Ninja 1.11_).
355 Additional lines may be added in future versions of Ninja.
363 Writing your own Ninja files
367 Ninja files yourself: for example, if you're writing a meta-build
373 Ninja evaluates a graph of dependencies between files, and runs
376 Make, Ninja is very similar.
378 A build file (default name: `build.ninja`) provides a list of _rules_
391 Here's a basic `.ninja` file that demonstrates most of the syntax.
406 build files readable (debuggable), Ninja supports declaring shorter
448 output files are missing or when the inputs change, Ninja will run the
488 If the top-level Ninja file is specified as an output of any build
489 statement and it is out of date, Ninja will rebuild and reload it
492 Generating Ninja files from code
495 `misc/ninja_syntax.py` in the Ninja distribution is a tiny Python
496 module to facilitate generating Ninja files. It allows you to make
497 Python calls like `ninja.rule(name='foo', command='bar',
516 This makes `ninja foo` build the longer path. Semantically, the
530 it does not exist. Without a phony build statement, Ninja will report
545 By default, if no targets are specified on the command line, Ninja
548 A default target statement causes Ninja to build only a given subset
562 This causes Ninja to build the `foo`, `bar` and `baz` targets by
567 The Ninja log
570 For each built file, Ninja keeps a log of the command used to build
571 it. Using this log Ninja can know when an existing output was built
584 _Available since Ninja 1.2._
586 Ninja version labels follow the standard major.minor.patch format,
589 behaviors. Your `build.ninja` may declare a variable named
590 `ninja_required_version` that asserts the minimum Ninja version
598 introduced in Ninja 1.1 (perhaps the `pool` syntax), and that
599 Ninja 1.1 or greater must be used to build. Unlike other Ninja
604 Ninja always warns if the major versions of Ninja and the
614 works in a similar way) correct Ninja has some extra functionality.
620 and Ninja can use that to get its dependencies perfect.
628 When loading these special dependencies, Ninja implicitly adds extra
640 To bring this information into Ninja requires cooperation. On the
641 Ninja side, the `depfile` attribute on the `build` must point to a
642 path where this data is written. (Ninja only supports the limited
659 _(Available since Ninja 1.3.)_
665 Ninja 1.3 can instead process dependencies just after they're generated
666 and save a compacted form of the same information in a Ninja-internal
669 Ninja supports this processing in two forms.
673 cause Ninja to process the `depfile` immediately after the
681 to its stdout. Ninja then filters these lines from the displayed
703 _Available since Ninja 1.1._
717 No matter what pools you specify, ninja will never run more concurrent jobs
758 _Available since Ninja 1.5._
762 standard input, output and error streams provided to Ninja, which are
767 While a task in the `console` pool is running, Ninja's regular output (such
772 Ninja file reference
790 Implicit outputs _(available since Ninja 1.7)_ may be added before
809 Ninja is mostly encoding agnostic, as long as the bytes Ninja cares
870 `builddir`:: a directory for some Ninja output files. See <<ref_log,the
874 `ninja_required_version`:: the minimum version of Ninja required to process
895 `deps`:: _(Available since Ninja 1.3.)_ if present, must be one of
901 `msvc_deps_prefix`:: _(Available since Ninja 1.5.)_ defines the string
910 `dyndep`:: _(Available since Ninja 1.10.)_ Used only on build statements.
935 `restat`:: if present, causes Ninja to re-stat the command's outputs
941 `rspfile`, `rspfile_content`:: if present (both), Ninja will use a
966 On Unixes, commands are arrays of arguments. The Ninja `command`
973 On Windows, commands are strings, so Ninja passes the `command` string
980 prefixing the command with `cmd /c`. Ninja may error with "invalid parameter"
997 Ninja 1.7)_. The semantics are identical to explicit outputs,
1013 Ninja doesn't know how to build them, the build is aborted.
1045 relative path, pointing to the same file, are considered different by Ninja.
1052 on the Ninja command line) whenever the build line is a transitive
1104 _(Available since Ninja 1.6)_
1106 The `subninja` keyword, used to include another `.ninja` file,
1111 To include another `.ninja` file in the current scope, much like a C
1135 _Available since Ninja 1.10._
1153 As soon as `foo` is finished Ninja will read it to load dynamically
1155 implicit inputs and/or outputs. Ninja will update the build graph
1163 as <<ref_ninja_file,ninja build files>> and have the following layout.
1187 to build statements in the <<ref_ninja_file,ninja build file>> that name the
1230 Ninja will load this file to add `foo.mod` as an implicit output of
1242 of the tarball and cannot be spelled out explicitly in the ninja build file.
1267 Ninja will load this file to add `file1.txt` and `file2.txt` as implicit
1270 extracted again. The `restat` binding tells Ninja to tolerate the fact