diff options
Diffstat (limited to 'doc/manual.asciidoc')
-rw-r--r-- | doc/manual.asciidoc | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc index bb120a5..112aac5 100644 --- a/doc/manual.asciidoc +++ b/doc/manual.asciidoc @@ -271,6 +271,30 @@ printed when run, logged (see below), nor do they contribute to the command count printed as part of the build process. +Default target statements +~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default, if no targets are specified on the command line, Ninja +will build every output that is not named as an input elsewhere. +You can override this behavior using a default target statement. +A default target statement causes Ninja to build only a given subset +of output files if none are specified on the command line. + +Default target statements begin with the `default` keyword, and have +the format +default _targets_+. A default target statement must appear +after the build statement that declares the target as an output file. +They are cumulative, so multiple statements may be used to extend +the list of default targets. For example: + +---------------- +default foo bar +default baz +---------------- + +This causes Ninja to build the `foo`, `bar` and `baz` targets by +default. + + The Ninja log ~~~~~~~~~~~~~ @@ -375,7 +399,9 @@ A file is a series of declarations. A declaration can be one of: 3. Variable declarations, which look like +_variable_ = _value_+. -4. References to more files, which look like +subninja _path_+ or +4. Default target statements, which look like +default _target1_ _target2_+. + +5. References to more files, which look like +subninja _path_+ or +include _path_+. The difference between these is explained below <<ref_scope,in the discussion about scoping>>. @@ -499,8 +525,9 @@ lookup order for a variable referenced in a rule is: Variable expansion ~~~~~~~~~~~~~~~~~~ -Variables are expanded in two cases: in the right side of a `name = -value` statement and in paths in a `build` statement. +Variables are expanded in three cases: in the right side of a `name = +value` statement, in paths in a `build` statement and in paths in +a `default` statement. When a `name = value` statement is evaluated, its right-hand side is expanded once (according to the above scoping rules) immediately, and @@ -508,9 +535,10 @@ from then on `$name` expands to the static string as the result of the expansion. It is never the case that you'll need to "double-escape" a variable with some syntax like `$$foo`. -A `build` statement is first parsed as a space-separated list of -filenames and then each name is expanded. This means that spaces -within a variable will result in spaces in the expanded filename. +A `build` or `default` statement is first parsed as a space-separated +list of filenames and then each name is expanded. This means that +spaces within a variable will result in spaces in the expanded +filename. ---- spaced = foo bar |