OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/variables.h" | 5 #include "tools/gn/variables.h" |
6 | 6 |
7 namespace variables { | 7 namespace variables { |
8 | 8 |
9 // Built-in variables ---------------------------------------------------------- | 9 // Built-in variables ---------------------------------------------------------- |
10 | 10 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 "\n" | 363 "\n" |
364 " Lists files required to run the given target. These are typically\n" | 364 " Lists files required to run the given target. These are typically\n" |
365 " data files.\n" | 365 " data files.\n" |
366 "\n" | 366 "\n" |
367 " Appearing in the \"data\" section does not imply any special handling\n" | 367 " Appearing in the \"data\" section does not imply any special handling\n" |
368 " such as copying them to the output directory. This is just used for\n" | 368 " such as copying them to the output directory. This is just used for\n" |
369 " declaring runtime dependencies. There currently isn't a good use for\n" | 369 " declaring runtime dependencies. There currently isn't a good use for\n" |
370 " these but it is envisioned that test data can be listed here for use\n" | 370 " these but it is envisioned that test data can be listed here for use\n" |
371 " running automated tests.\n" | 371 " running automated tests.\n" |
372 "\n" | 372 "\n" |
373 " See also \"gn help source_prereqs\" and \"gn help datadeps\", both of\n" | 373 " See also \"gn help inputs\" and \"gn help datadeps\", both of\n" |
374 " which actually affect the build in concrete ways.\n"; | 374 " which actually affect the build in concrete ways.\n"; |
375 | 375 |
376 const char kDatadeps[] = "datadeps"; | 376 const char kDatadeps[] = "datadeps"; |
377 const char kDatadeps_HelpShort[] = | 377 const char kDatadeps_HelpShort[] = |
378 "datadeps: [label list] Non-linked dependencies."; | 378 "datadeps: [label list] Non-linked dependencies."; |
379 const char kDatadeps_Help[] = | 379 const char kDatadeps_Help[] = |
380 "datadeps: Non-linked dependencies.\n" | 380 "datadeps: Non-linked dependencies.\n" |
381 "\n" | 381 "\n" |
382 " A list of target labels.\n" | 382 " A list of target labels.\n" |
383 "\n" | 383 "\n" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 "\n" | 529 "\n" |
530 " A list of source directories.\n" | 530 " A list of source directories.\n" |
531 "\n" | 531 "\n" |
532 " The directories in this list will be added to the include path for\n" | 532 " The directories in this list will be added to the include path for\n" |
533 " the files in the affected target.\n" | 533 " the files in the affected target.\n" |
534 COMMON_ORDERING_HELP | 534 COMMON_ORDERING_HELP |
535 "\n" | 535 "\n" |
536 "Example:\n" | 536 "Example:\n" |
537 " include_dirs = [ \"src/include\", \"//third_party/foo\" ]\n"; | 537 " include_dirs = [ \"src/include\", \"//third_party/foo\" ]\n"; |
538 | 538 |
| 539 const char kInputs[] = "inputs"; |
| 540 const char kInputs_HelpShort[] = |
| 541 "inputs: [file list] Additional compile-time dependencies."; |
| 542 const char kInputs_Help[] = |
| 543 "inputs: Additional compile-time dependencies.\n" |
| 544 "\n" |
| 545 " Inputs are compile-time dependencies of the current target. This means\n" |
| 546 " that all inputs must be available before compiling any of the sources\n" |
| 547 " or executing any actions.\n" |
| 548 "\n" |
| 549 " Inputs are typically only used for action and action_foreach targets.\n" |
| 550 "\n" |
| 551 "Inputs for actions\n" |
| 552 "\n" |
| 553 " For action and action_foreach targets, inputs should be the inputs to\n" |
| 554 " script that don't vary. These should be all .py files that the script\n" |
| 555 " uses via imports (the main script itself will be an implcit dependency\n" |
| 556 " of the action so need not be listed).\n" |
| 557 "\n" |
| 558 " For action targets, inputs should be the entire set of inputs the\n" |
| 559 " script needs. For action_foreach targets, inputs should be the set of\n" |
| 560 " dependencies that don't change. These will be applied to each script\n" |
| 561 " invocation over the sources.\n" |
| 562 "\n" |
| 563 " Note that another way to declare input dependencies from an action\n" |
| 564 " is to have the action write a depfile (see \"gn help depfile\"). This\n" |
| 565 " allows the script to dynamically write input dependencies, that might\n" |
| 566 " not be known until actually executing the script. This is more\n" |
| 567 " efficient than doing processing while running GN to determine the\n" |
| 568 " inputs, and is easier to keep in-sync than hardcoding the list.\n" |
| 569 "\n" |
| 570 "Inputs for binary targets\n" |
| 571 "\n" |
| 572 " Any input dependencies will be resolved before compiling any sources.\n" |
| 573 " Normally, all actions that a target depends on will be run before any\n" |
| 574 " files in a target are compiled. So if you depend on generated headers,\n" |
| 575 " you do not typically need to list them in the inputs section.\n" |
| 576 "\n" |
| 577 "Example\n" |
| 578 "\n" |
| 579 " action(\"myscript\") {\n" |
| 580 " script = \"domything.py\"\n" |
| 581 " inputs = [ \"input.data\" ]\n" |
| 582 " }\n"; |
| 583 |
539 const char kLdflags[] = "ldflags"; | 584 const char kLdflags[] = "ldflags"; |
540 const char kLdflags_HelpShort[] = | 585 const char kLdflags_HelpShort[] = |
541 "ldflags: [string list] Flags passed to the linker."; | 586 "ldflags: [string list] Flags passed to the linker."; |
542 const char kLdflags_Help[] = | 587 const char kLdflags_Help[] = |
543 "ldflags: Flags passed to the linker.\n" | 588 "ldflags: Flags passed to the linker.\n" |
544 "\n" | 589 "\n" |
545 " A list of strings.\n" | 590 " A list of strings.\n" |
546 "\n" | 591 "\n" |
547 " These flags are passed on the command-line to the linker and generally\n" | 592 " These flags are passed on the command-line to the linker and generally\n" |
548 " specify various linking options. Most targets will not need these and\n" | 593 " specify various linking options. Most targets will not need these and\n" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 const char kScript[] = "script"; | 742 const char kScript[] = "script"; |
698 const char kScript_HelpShort[] = | 743 const char kScript_HelpShort[] = |
699 "script: [file name] Script file for actions."; | 744 "script: [file name] Script file for actions."; |
700 const char kScript_Help[] = | 745 const char kScript_Help[] = |
701 "script: Script file for actions.\n" | 746 "script: Script file for actions.\n" |
702 "\n" | 747 "\n" |
703 " An absolute or buildfile-relative file name of a Python script to run\n" | 748 " An absolute or buildfile-relative file name of a Python script to run\n" |
704 " for a action and action_foreach targets (see \"gn help action\" and\n" | 749 " for a action and action_foreach targets (see \"gn help action\" and\n" |
705 " \"gn help action_foreach\").\n"; | 750 " \"gn help action_foreach\").\n"; |
706 | 751 |
707 const char kSourcePrereqs[] = "source_prereqs"; | |
708 const char kSourcePrereqs_HelpShort[] = | |
709 "source_prereqs: [file list] Additional compile-time dependencies."; | |
710 const char kSourcePrereqs_Help[] = | |
711 "source_prereqs: Additional compile-time dependencies.\n" | |
712 "\n" | |
713 " Inputs are compile-time dependencies of the current target. This means\n" | |
714 " that all source prerequisites must be available before compiling any\n" | |
715 " of the sources.\n" | |
716 "\n" | |
717 " If one of your sources #includes a generated file, that file must be\n" | |
718 " available before that source file is compiled. For subsequent builds,\n" | |
719 " the \".d\" files will list the include dependencies of each source\n" | |
720 " and Ninja can know about that dependency to make sure it's generated\n" | |
721 " before compiling your source file. However, for the first run it's\n" | |
722 " not possible for Ninja to know about this dependency.\n" | |
723 "\n" | |
724 " Source prerequisites solves this problem by declaring such\n" | |
725 " dependencies. It will introduce a Ninja \"implicit\" dependency for\n" | |
726 " each source file in the target on the listed files.\n" | |
727 "\n" | |
728 " For binary targets, the files in the \"source_prereqs\" should all be\n" | |
729 " listed in the \"outputs\" section of another target. There is no\n" | |
730 " reason to declare static source files as source prerequisites since\n" | |
731 " the normal include file dependency management will handle them more\n" | |
732 " efficiently anyway.\n" | |
733 "\n" | |
734 " For action targets that don't generate \".d\" files, the\n" | |
735 " \"source_prereqs\" section is how you can list known compile-time\n" | |
736 " dependencies your script may have.\n" | |
737 "\n" | |
738 " See also \"gn help data\" and \"gn help datadeps\" (which declare\n" | |
739 " run-time rather than compile-time dependencies).\n" | |
740 "\n" | |
741 "Examples:\n" | |
742 " executable(\"foo\") {\n" | |
743 " sources = [ \"foo.cc\" ]\n" | |
744 " source_prereqs = [ \"$root_gen_dir/something/generated_data.h\" ]\n" | |
745 " }\n" | |
746 "\n" | |
747 " action(\"myscript\") {\n" | |
748 " script = \"domything.py\"\n" | |
749 " source_prereqs = [ \"input.data\" ]\n" | |
750 " }\n"; | |
751 | |
752 const char kSources[] = "sources"; | 752 const char kSources[] = "sources"; |
753 const char kSources_HelpShort[] = | 753 const char kSources_HelpShort[] = |
754 "sources: [file list] Source files for a target."; | 754 "sources: [file list] Source files for a target."; |
755 const char kSources_Help[] = | 755 const char kSources_Help[] = |
756 "sources: Source files for a target\n" | 756 "sources: Source files for a target\n" |
757 "\n" | 757 "\n" |
758 " A list of files relative to the current buildfile.\n"; | 758 " A list of files relative to the current buildfile.\n"; |
759 | 759 |
760 const char kVisibility[] = "visibility"; | 760 const char kVisibility[] = "visibility"; |
761 const char kVisibility_HelpShort[] = | 761 const char kVisibility_HelpShort[] = |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 INSERT_VARIABLE(CflagsObjC) | 870 INSERT_VARIABLE(CflagsObjC) |
871 INSERT_VARIABLE(CflagsObjCC) | 871 INSERT_VARIABLE(CflagsObjCC) |
872 INSERT_VARIABLE(Configs) | 872 INSERT_VARIABLE(Configs) |
873 INSERT_VARIABLE(Data) | 873 INSERT_VARIABLE(Data) |
874 INSERT_VARIABLE(Datadeps) | 874 INSERT_VARIABLE(Datadeps) |
875 INSERT_VARIABLE(Depfile) | 875 INSERT_VARIABLE(Depfile) |
876 INSERT_VARIABLE(Deps) | 876 INSERT_VARIABLE(Deps) |
877 INSERT_VARIABLE(DirectDependentConfigs) | 877 INSERT_VARIABLE(DirectDependentConfigs) |
878 INSERT_VARIABLE(ForwardDependentConfigsFrom) | 878 INSERT_VARIABLE(ForwardDependentConfigsFrom) |
879 INSERT_VARIABLE(IncludeDirs) | 879 INSERT_VARIABLE(IncludeDirs) |
| 880 INSERT_VARIABLE(Inputs) |
880 INSERT_VARIABLE(Ldflags) | 881 INSERT_VARIABLE(Ldflags) |
881 INSERT_VARIABLE(Libs) | 882 INSERT_VARIABLE(Libs) |
882 INSERT_VARIABLE(LibDirs) | 883 INSERT_VARIABLE(LibDirs) |
883 INSERT_VARIABLE(OutputExtension) | 884 INSERT_VARIABLE(OutputExtension) |
884 INSERT_VARIABLE(OutputName) | 885 INSERT_VARIABLE(OutputName) |
885 INSERT_VARIABLE(Outputs) | 886 INSERT_VARIABLE(Outputs) |
886 INSERT_VARIABLE(Public) | 887 INSERT_VARIABLE(Public) |
887 INSERT_VARIABLE(Script) | 888 INSERT_VARIABLE(Script) |
888 INSERT_VARIABLE(SourcePrereqs) | |
889 INSERT_VARIABLE(Sources) | 889 INSERT_VARIABLE(Sources) |
890 INSERT_VARIABLE(Visibility) | 890 INSERT_VARIABLE(Visibility) |
891 } | 891 } |
892 return info_map; | 892 return info_map; |
893 } | 893 } |
894 | 894 |
895 #undef INSERT_VARIABLE | 895 #undef INSERT_VARIABLE |
896 | 896 |
897 } // namespace variables | 897 } // namespace variables |
OLD | NEW |