OLD | NEW |
---|---|
1 # GN Reference | 1 # GN Reference |
2 | 2 |
3 *This page is automatically generated from* `gn help --markdown all`. | 3 *This page is automatically generated from* `gn help --markdown all`. |
4 | 4 |
5 ## Contents | 5 ## Contents |
6 | 6 |
7 * [Commands](#commands) | 7 * [Commands](#commands) |
8 * [analyze: Analyze which targets are affected by a list of files.](#analy ze) | 8 * [analyze: Analyze which targets are affected by a list of files.](#analy ze) |
9 * [args: Display or configure arguments declared by the build.](#args) | 9 * [args: Display or configure arguments declared by the build.](#args) |
10 * [check: Check header dependencies.](#check) | 10 * [check: Check header dependencies.](#check) |
(...skipping 5337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5348 If unspecified, the ability to call exec_script is unrestricted. | 5348 If unspecified, the ability to call exec_script is unrestricted. |
5349 | 5349 |
5350 Example: | 5350 Example: |
5351 exec_script_whitelist = [ | 5351 exec_script_whitelist = [ |
5352 "//base/BUILD.gn", | 5352 "//base/BUILD.gn", |
5353 "//build/my_config.gni", | 5353 "//build/my_config.gni", |
5354 ] | 5354 ] |
5355 | 5355 |
5356 root [optional] | 5356 root [optional] |
5357 Label of the root build target. The GN build will start by loading the | 5357 Label of the root build target. The GN build will start by loading the |
5358 build file containing this target name. This defaults to "//:" which will | 5358 build file containing this target name. This defaults to label which will |
5359 cause the file //BUILD.gn to be loaded. | 5359 cause the file //BUILD.gn to be loaded. |
5360 | 5360 |
5361 secondary_source [optional] | 5361 secondary_source [optional] |
5362 Label of an alternate directory tree to find input files. When searching | 5362 Label of an alternate directory tree to find input files. When searching |
5363 for a BUILD.gn file (or the build config file discussed above), the file | 5363 for a BUILD.gn file (or the build config file discussed above), the file |
5364 will first be looked for in the source root. If it's not found, the | 5364 will first be looked for in the source root. If it's not found, the |
5365 secondary source root will be checked (which would contain a parallel | 5365 secondary source root will be checked (which would contain a parallel |
5366 directory hierarchy). | 5366 directory hierarchy). |
5367 | 5367 |
5368 This behavior is intended to be used when BUILD.gn files can't be checked | 5368 This behavior is intended to be used when BUILD.gn files can't be checked |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5854 //tools/gn -> //tools/gn:gn | 5854 //tools/gn -> //tools/gn:gn |
5855 ``` | 5855 ``` |
5856 ### <a name="ninja_rules"></a>**Ninja build rules** | 5856 ### <a name="ninja_rules"></a>**Ninja build rules** |
5857 | 5857 |
5858 #### **The "all" and "default" rules** | 5858 #### **The "all" and "default" rules** |
5859 | 5859 |
5860 ``` | 5860 ``` |
5861 All generated targets (see "gn help execution") will be added to an implicit | 5861 All generated targets (see "gn help execution") will be added to an implicit |
5862 build rule called "all" so "ninja all" will always compile everything. The | 5862 build rule called "all" so "ninja all" will always compile everything. The |
5863 default rule will be used by Ninja if no specific target is specified (just | 5863 default rule will be used by Ninja if no specific target is specified (just |
5864 typing "ninja"). If there is a target named "//:default" it will be the | 5864 typing "ninja"). If there is a target named "//:default" (or $root:default in |
brettw
2017/04/19 19:49:25
"root" isn't a variable anywhere but the dotfile,
Petr Hosek
2017/04/19 20:20:26
Done.
| |
5865 default build rule, otherwise the implicit "all" rule will be used. | 5865 case the non-default root build target is used) it will be the default build |
5866 rule, otherwise the implicit "all" rule will be used. | |
5866 ``` | 5867 ``` |
5867 | 5868 |
5868 #### **Phony rules** | 5869 #### **Phony rules** |
5869 | 5870 |
5870 ``` | 5871 ``` |
5871 GN generates Ninja "phony" rules for targets in the default toolchain. The | 5872 GN generates Ninja "phony" rules for targets in the default toolchain. The |
5872 phony rules can collide with each other and with the names of generated files | 5873 phony rules can collide with each other and with the names of generated files |
5873 so are generated with the following priority: | 5874 so are generated with the following priority: |
5874 | 5875 |
5875 1. Actual files generated by the build always take precedence. | 5876 1. Actual files generated by the build always take precedence. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6146 * [--root: Explicitly specify source root.](#--root) | 6147 * [--root: Explicitly specify source root.](#--root) |
6147 * [--runtime-deps-list-file: Save runtime dependencies for targets in file .](#--runtime-deps-list-file) | 6148 * [--runtime-deps-list-file: Save runtime dependencies for targets in file .](#--runtime-deps-list-file) |
6148 * [--script-executable: Set the executable used to execute scripts.](#--sc ript-executable) | 6149 * [--script-executable: Set the executable used to execute scripts.](#--sc ript-executable) |
6149 * [--threads: Specify number of worker threads.](#--threads) | 6150 * [--threads: Specify number of worker threads.](#--threads) |
6150 * [--time: Outputs a summary of how long everything took.](#--time) | 6151 * [--time: Outputs a summary of how long everything took.](#--time) |
6151 * [--tracelog: Writes a Chrome-compatible trace log to the given file.](#- -tracelog) | 6152 * [--tracelog: Writes a Chrome-compatible trace log to the given file.](#- -tracelog) |
6152 * [-v: Verbose logging.](#-v) | 6153 * [-v: Verbose logging.](#-v) |
6153 * [--version: Prints the GN version number and exits.](#--version) | 6154 * [--version: Prints the GN version number and exits.](#--version) |
6154 ``` | 6155 ``` |
6155 | 6156 |
OLD | NEW |