Lines Matching +full:implicit +full:- +full:dynamic
7 ------------
18 non-recursive Makefiles) would take ten seconds to start building
24 Where other build systems are high-level languages, Ninja aims to be
28 in a edit-compile cycle you want it to be as fast as possible -- you
40 incremental builds stay fast. Going beyond autotools, even build-time
42 build a debug or release-mode binary?" belong in the `.ninja` file
54 higher-level build systems have different opinions about how code
63 difficult to get right with Makefiles (e.g. outputs need an implicit
65 source code you need to use gcc's `-M` flags for header
70 Some explicit _non-goals_:
76 * built-in rules. _Out of the box, Ninja has no rules for
79 * build-time customization of the build. _Options belong in
82 * build-time decision-making ability such as conditionals or search
96 functions, built-in rules that e.g. search for RCS files when building
137 ----------------------------
139 Ninja currently works on Unix-like systems and Windows. It's seen the
147 edit-compile cycle time of your project already then Ninja won't help.
149 There are many other build systems that are more user-friendly or
156 meta-build system.
158 https://gn.googlesource.com/gn/[gn]:: The meta-build system used to
163 https://cmake.org/[CMake]:: A widely used meta-build system that
167 …github.com/ninja-build/ninja/wiki/List-of-generators-producing-ninja-build-files[others]:: Ninja o…
175 the current directory and builds all out-of-date targets. You can
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
188 you don't need to pass `-j`.)
207 specified by `-j` or its default)
218 The `-t` flag on the Ninja command line runs some tools that we have
229 ----
230 ninja -t browse --port=8000 --no-browser mytarget
231 ----
236 ----
237 ninja -t graph mytarget | dot -Tpng -ograph.png
238 ----
245 like +ninja -t targets rule _name_+ it prints the list of targets
248 +ninja -t targets depth _digit_+ it
249 prints the list of targets in a depth-first manner starting by the root
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
262 except for those created by the generator. Adding the `-g` flag also
268 If used like +ninja -t clean -r _rules_+ it removes all files built using
272 tool takes in account the +-v+ and the +-n+ options (note that +-n+
273 implies +-v+).
295 +ninja -t targets rule _name_+ or +ninja -t compdb+.
298 ----------------------------
301 Ninja files yourself: for example, if you're writing a meta-build
313 -- short names for longer commands, like how to run the compiler --
315 using the rules -- which rule to apply to which inputs to produce
328 ---------------------------------
329 cflags = -Wall
332 command = gcc $cflags -c $in -o $out
335 ---------------------------------
339 Despite the non-goal of being convenient to write by hand, to keep
343 ----------------
344 cflags = -g
345 ----------------
350 ----------------
352 command = gcc $cflags -c $in -o $out
353 ----------------
396 ----------------
397 cflags = -Wall -Werror
399 command = gcc $cflags -c $in -o $out
406 cflags = -Wall
412 ----------------
422 If the top-level Ninja file is specified as an output of any build
438 ------------
446 ----------------
448 ----------------
463 ----------------
468 ----------------
486 ----------------
489 ----------------
516 where the major version is increased on backwards-incompatible
522 -----
524 -----
576 ----
579 command = gcc -MD -MF $out.d [other gcc flags here]
580 ----
582 The `-MD` flag to `gcc` tells it to output header dependencies, and
583 the `-MF` flag tells it where to write them.
595 and save a compacted form of the same information in a Ninja-internal
600 1. `deps = gcc` specifies that the tool outputs `gcc`-style dependencies
608 http://msdn.microsoft.com/en-us/library/hdkef6tk(v=vs.90).aspx[`/showIncludes`
609 flag]. Briefly, this means the tool outputs specially-formatted lines
616 ----
620 command = cl /showIncludes -c $in /Fo$out
621 ----
648 line (with `-j`).
650 ----------------
682 ----------------
689 There exists a pre-defined pool named `console` with a depth of 1. It has
693 redirected. This can be useful for interactive tasks or long-running tasks
702 --------------------
711 Implicit dependencies may be tacked on the end with +|
713 Order-only dependencies may be tacked on the end with +||
717 Implicit outputs _(available since Ninja 1.7)_ may be added before
737 about (like slashes in paths) are ASCII. This means e.g. UTF-8 or
738 ISO-8859-1 input files ought to work.
743 of space-separated tokens that end at the newline. Newlines and
764 A `build` or `default` statement is first parsed as a space-separated
769 ----
773 ----
779 ----
784 ----
792 Top-level variables
832 `description`:: a short description of the command, used to pretty-print
833 the command as it's running. The `-v` flag controls whether to print
840 See the <<ref_dyndep,dynamic dependencies>> section for details.
843 re-invoke the generator program. Files built using `generator`
848 `in`:: the space-separated list of files provided as inputs to the build line
849 referencing this `rule`, shell-quoted if it appears in commands. (`$in` is
857 it uses a fixed-size buffer for processing input.)
859 `out`:: the space-separated list of files provided as outputs to the build line
860 referencing this `rule`, shell-quoted if it appears in commands.
862 `restat`:: if present, causes Ninja to re-stat the command's outputs
879 ----
886 ----
894 variable is passed directly to `sh -c`, which is then responsible for
925 the only difference is that implicit outputs don't show up in the
948 explicit dependencies, the only difference is that implicit dependencies
953 script, the script itself should be an implicit dependency, as
959 3. _Order-only dependencies_, expressed with the syntax +|| _dep1_
961 output is not rebuilt until they are built, but changes in order-only
964 Order-only dependencies can be useful for bootstrapping dependencies
968 express the implicit dependency.)
979 When a `name = value` statement is evaluated, its right-hand side is
982 expansion. It is never the case that you'll need to "double-escape" a
990 ----
996 ----
1002 Top-level variable declarations are scoped to the file they occur in.
1019 1. Special built-in variables (`$in`, `$out`).
1021 2. Build-level variables from the `build` block.
1023 3. Rule-level variables from the `rule` block (i.e. `$command`).
1025 expanded "late", and may make use of in-scope bindings like `$in`.)
1027 4. File-level variables from the file that the `build` line was in.
1033 Dynamic Dependencies
1034 --------------------
1038 Some use cases require implicit dependency information to be dynamically
1043 `dyndep` binding naming one of its inputs to specify that dynamic
1046 ----
1050 ----
1056 implicit inputs and/or outputs. Ninja will update the build graph
1068 ----
1070 ----
1077 ----
1078 build out | imp-outs... : dyndep | imp-ins...
1079 ----
1082 the rule name `dyndep`. The `| imp-outs...` and `| imp-ins...` portions
1087 The build statements in a dyndep file must have a one-to-one correspondence
1099 `foo.mod` (an implicit output of compilation) and another source file
1100 `bar.f90` that uses the module (an implicit input of compilation). This
1101 implicit dependency must be discovered before we compile either source
1106 ----
1108 command = f95 -o $out -c $in
1110 command = fscan -o $out $in
1118 ----
1120 In this example the order-only dependencies ensure that `foobar.dd` is
1125 ----
1129 ----
1131 Ninja will load this file to add `foo.mod` as an implicit output of
1132 `foo.o` and implicit input of `bar.o`. This ensures that the Fortran
1141 the tarball changes, but we also would like to re-extract if any of the
1146 ----
1150 command = scantar --stamp=$stamp --dd=$out $in
1155 ----
1157 In this example the order-only dependency ensures that `foo.tar.dd` is
1162 ----
1166 ----
1168 Ninja will load this file to add `file1.txt` and `file2.txt` as implicit
1170 On future builds, if any implicit output is missing the tarball will be
1172 that the implicit outputs may not have modification times newer than
1173 the tarball itself (avoiding re-extraction on every build).