summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-08-31 03:55:35 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2011-08-31 16:51:05 (GMT)
commit7a6c9d480d4ca7020f74e5f4dfbaf28c9ff2a6a4 (patch)
tree20aff5ee6b1061c0f53c51805419225a1367b2bd /doc
parent679305757e68861885f1e5c819625d2f0bca6c0b (diff)
downloadNinja-7a6c9d480d4ca7020f74e5f4dfbaf28c9ff2a6a4.zip
Ninja-7a6c9d480d4ca7020f74e5f4dfbaf28c9ff2a6a4.tar.gz
Ninja-7a6c9d480d4ca7020f74e5f4dfbaf28c9ff2a6a4.tar.bz2
Implement default target statements
This introduces a new directive, the default target statement, which may be used to control the list of targets built by default (i.e. if no target is named on the command line).
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.asciidoc40
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