OLD | NEW |
1 # GN Language and Operation | 1 # GN Language and Operation |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Introduction | 5 ## Introduction |
6 | 6 |
7 This page describes many of the language details and behaviors. | 7 This page describes many of the language details and behaviors. |
8 | 8 |
9 ### Use the built-in help! | 9 ### Use the built-in help! |
10 | 10 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 2. Execute the build config file (this is the default toolchain). In Chrome | 334 2. Execute the build config file (this is the default toolchain). In Chrome |
335 this is `//build/config/BUILDCONFIG.gn`. | 335 this is `//build/config/BUILDCONFIG.gn`. |
336 3. Load the `BUILD.gn` file in the root directory. | 336 3. Load the `BUILD.gn` file in the root directory. |
337 4. Recursively load `BUILD.gn` in other directories to resolve all | 337 4. Recursively load `BUILD.gn` in other directories to resolve all |
338 current dependencies. If a BUILD file isn't found in the specified | 338 current dependencies. If a BUILD file isn't found in the specified |
339 location, GN will look in the corresponding location inside | 339 location, GN will look in the corresponding location inside |
340 `build/secondary`. | 340 `build/secondary`. |
341 5. When a target's dependencies are resolved, write out the `.ninja` | 341 5. When a target's dependencies are resolved, write out the `.ninja` |
342 file to disk. | 342 file to disk. |
343 6. When all targets are resolved, write out the root `build.ninja` | 343 6. When all targets are resolved, write out the root `build.ninja` |
344 file. | 344 file. If the top-level build file defines a group called "default" |
| 345 (i.e., `//:default`), GN will tell Ninja to use that for the |
| 346 default build target, rather than building everything. (You can |
| 347 still use `ninja all` to build everything). |
345 | 348 |
346 ### The build config file | 349 ### The build config file |
347 | 350 |
348 The first file executed is the build config file. The name of this file | 351 The first file executed is the build config file. The name of this file |
349 is specified in the `.gn` file that marks the root of the repository. In | 352 is specified in the `.gn` file that marks the root of the repository. In |
350 Chrome it is `//build/config/BUILDCONFIG.gn`. There is only one build | 353 Chrome it is `//build/config/BUILDCONFIG.gn`. There is only one build |
351 config file. | 354 config file. |
352 | 355 |
353 This file sets up the scope in which all other build files will execute. | 356 This file sets up the scope in which all other build files will execute. |
354 Any arguments, variables, defaults, etc. set up in this file will be | 357 Any arguments, variables, defaults, etc. set up in this file will be |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 GN keeps some GYP concept like "all dependent" settings which work a bit | 804 GN keeps some GYP concept like "all dependent" settings which work a bit |
802 differently in Blaze. This is partially to make conversion from the existing | 805 differently in Blaze. This is partially to make conversion from the existing |
803 GYP code easier, and the GYP constructs generally offer more fine-grained | 806 GYP code easier, and the GYP constructs generally offer more fine-grained |
804 control (which is either good or bad, depending on the situation). | 807 control (which is either good or bad, depending on the situation). |
805 | 808 |
806 GN also uses GYP names like "sources" instead of "srcs" since | 809 GN also uses GYP names like "sources" instead of "srcs" since |
807 abbreviating this seems needlessly obscure, although it uses Blaze's | 810 abbreviating this seems needlessly obscure, although it uses Blaze's |
808 "deps" since "dependencies" is so hard to type. Chromium also compiles | 811 "deps" since "dependencies" is so hard to type. Chromium also compiles |
809 multiple languages in one target so specifying the language type on the | 812 multiple languages in one target so specifying the language type on the |
810 target name prefix was dropped (e.g. from `cc_library`). | 813 target name prefix was dropped (e.g. from `cc_library`). |
OLD | NEW |