| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/functions.h" | 9 #include "tools/gn/functions.h" |
| 10 #include "tools/gn/parse_tree.h" | 10 #include "tools/gn/parse_tree.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 " arguments specified by the toolchain_args section of the toolchain\n" | 259 " arguments specified by the toolchain_args section of the toolchain\n" |
| 260 " definition (see \"gn help toolchain_args\").\n" | 260 " definition (see \"gn help toolchain_args\").\n" |
| 261 " 3. Loads the destination build file in the context of the\n" | 261 " 3. Loads the destination build file in the context of the\n" |
| 262 " configuration file in the previous step.\n" | 262 " configuration file in the previous step.\n" |
| 263 "\n" | 263 "\n" |
| 264 "Example:\n" | 264 "Example:\n" |
| 265 " toolchain(\"plugin_toolchain\") {\n" | 265 " toolchain(\"plugin_toolchain\") {\n" |
| 266 " concurrent_links = 8\n" | 266 " concurrent_links = 8\n" |
| 267 "\n" | 267 "\n" |
| 268 " tool(\"cc\") {\n" | 268 " tool(\"cc\") {\n" |
| 269 " command = \"gcc $in\"\n" | 269 " command = \"gcc {{source}}\"\n" |
| 270 " ...\n" | 270 " ...\n" |
| 271 " }\n" | 271 " }\n" |
| 272 "\n" | 272 "\n" |
| 273 " toolchain_args() {\n" | 273 " toolchain_args() {\n" |
| 274 " is_plugin = true\n" | 274 " is_plugin = true\n" |
| 275 " is_32bit = true\n" | 275 " is_32bit = true\n" |
| 276 " is_64bit = false\n" | 276 " is_64bit = false\n" |
| 277 " }\n" | 277 " }\n" |
| 278 " }\n"; | 278 " }\n"; |
| 279 | 279 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 " current directory for running all tools. These expansions are\n" | 546 " current directory for running all tools. These expansions are\n" |
| 547 " available to all tools:\n" | 547 " available to all tools:\n" |
| 548 "\n" | 548 "\n" |
| 549 " {{label}}\n" | 549 " {{label}}\n" |
| 550 " The label of the current target. This is typically used in the\n" | 550 " The label of the current target. This is typically used in the\n" |
| 551 " \"description\" field for link tools. The toolchain will be\n" | 551 " \"description\" field for link tools. The toolchain will be\n" |
| 552 " omitted from the label for targets in the default toolchain, and\n" | 552 " omitted from the label for targets in the default toolchain, and\n" |
| 553 " will be included for targets in other toolchains.\n" | 553 " will be included for targets in other toolchains.\n" |
| 554 "\n" | 554 "\n" |
| 555 " {{output}}\n" | 555 " {{output}}\n" |
| 556 " The relative path and name of the output)((s) of the current\n" | 556 " The relative path and name of the output(s) of the current\n" |
| 557 " build step. If there is more than one output, this will expand\n" | 557 " build step. If there is more than one output, this will expand\n" |
| 558 " to a list of all of them.\n" | 558 " to a list of all of them.\n" |
| 559 " Example: \"out/base/my_file.o\"\n" | 559 " Example: \"out/base/my_file.o\"\n" |
| 560 "\n" | 560 "\n" |
| 561 " {{target_gen_dir}}\n" | 561 " {{target_gen_dir}}\n" |
| 562 " {{target_out_dir}}\n" | 562 " {{target_out_dir}}\n" |
| 563 " The directory of the generated file and output directories,\n" | 563 " The directory of the generated file and output directories,\n" |
| 564 " respectively, for the current target. There is no trailing\n" | 564 " respectively, for the current target. There is no trailing\n" |
| 565 " slash.\n" | 565 " slash.\n" |
| 566 " Example: \"out/base/test\"\n" | 566 " Example: \"out/base/test\"\n" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 "\n" | 624 "\n" |
| 625 " The \"_newline\" version will separate the input files with\n" | 625 " The \"_newline\" version will separate the input files with\n" |
| 626 " newlines instead of spaces. This is useful in response files:\n" | 626 " newlines instead of spaces. This is useful in response files:\n" |
| 627 " some linkers can take a \"-filelist\" flag which expects newline\n" | 627 " some linkers can take a \"-filelist\" flag which expects newline\n" |
| 628 " separated files, and some Microsoft tools have a fixed-sized\n" | 628 " separated files, and some Microsoft tools have a fixed-sized\n" |
| 629 " buffer for parsing each line of a response file.\n" | 629 " buffer for parsing each line of a response file.\n" |
| 630 "\n" | 630 "\n" |
| 631 " {{ldflags}}\n" | 631 " {{ldflags}}\n" |
| 632 " Expands to the processed set of ldflags and library search paths\n" | 632 " Expands to the processed set of ldflags and library search paths\n" |
| 633 " specified for the target.\n" | 633 " specified for the target.\n" |
| 634 " Example: \"-m64, -fPIC -pthread -L/usr/local/mylib\"\n" | 634 " Example: \"-m64 -fPIC -pthread -L/usr/local/mylib\"\n" |
| 635 "\n" | 635 "\n" |
| 636 " {{libs}}\n" | 636 " {{libs}}\n" |
| 637 " Expands to the list of system libraries to link to. Each will\n" | 637 " Expands to the list of system libraries to link to. Each will\n" |
| 638 " be prefixed by the \"lib_prefix\".\n" | 638 " be prefixed by the \"lib_prefix\".\n" |
| 639 "\n" | 639 "\n" |
| 640 " As a special case to support Mac, libraries with names ending in\n" | 640 " As a special case to support Mac, libraries with names ending in\n" |
| 641 " \".framework\" will be added to the {{libs}} with \"-framework\"\n" | 641 " \".framework\" will be added to the {{libs}} with \"-framework\"\n" |
| 642 " preceeding it, and the lib prefix will be ignored.\n" | 642 " preceeding it, and the lib prefix will be ignored.\n" |
| 643 "\n" | 643 "\n" |
| 644 " Example: \"-lfoo -lbar\"\n" | 644 " Example: \"-lfoo -lbar\"\n" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 " it will always assume that running a command updates the output):\n" | 681 " it will always assume that running a command updates the output):\n" |
| 682 "\n" | 682 "\n" |
| 683 " tool(\"solink\") {\n" | 683 " tool(\"solink\") {\n" |
| 684 " command = \"...\"\n" | 684 " command = \"...\"\n" |
| 685 " outputs = [\n" | 685 " outputs = [\n" |
| 686 " \"{{root_out_dir}}/{{target_output_name}}{{output_extension}}\",\n" | 686 " \"{{root_out_dir}}/{{target_output_name}}{{output_extension}}\",\n" |
| 687 " \"{{root_out_dir}}/{{target_output_name}}" | 687 " \"{{root_out_dir}}/{{target_output_name}}" |
| 688 "{{output_extension}}.TOC\",\n" | 688 "{{output_extension}}.TOC\",\n" |
| 689 " ]\n" | 689 " ]\n" |
| 690 " link_output =\n" | 690 " link_output =\n" |
| 691 " \"{{root_out_dir}}/{{target_output_name}}{{output_extension}}\",\n" | 691 " \"{{root_out_dir}}/{{target_output_name}}{{output_extension}}\"\n" |
| 692 " depend_output =\n" | 692 " depend_output =\n" |
| 693 " \"{{root_out_dir}}/{{target_output_name}}" | 693 " \"{{root_out_dir}}/{{target_output_name}}" |
| 694 "{{output_extension}}.TOC\",\n" | 694 "{{output_extension}}.TOC\"\n" |
| 695 " restat = true\n" | 695 " restat = true\n" |
| 696 " }\n" | 696 " }\n" |
| 697 "\n" | 697 "\n" |
| 698 "Example\n" | 698 "Example\n" |
| 699 "\n" | 699 "\n" |
| 700 " toolchain(\"my_toolchain\") {\n" | 700 " toolchain(\"my_toolchain\") {\n" |
| 701 " # Put these at the top to apply to all tools below.\n" | 701 " # Put these at the top to apply to all tools below.\n" |
| 702 " lib_prefix = \"-l\"\n" | 702 " lib_prefix = \"-l\"\n" |
| 703 " lib_dir_prefix = \"-L\"\n" | 703 " lib_dir_prefix = \"-L\"\n" |
| 704 "\n" | 704 "\n" |
| 705 " tool(\"cc\") {\n" | 705 " tool(\"cc\") {\n" |
| 706 " command = \"gcc \\$in -o \\$out\"\n" | 706 " command = \"gcc {{source}} -o {{output}}\"\n" |
| 707 " outputs = [ \"{{source_out_dir}}/{{source_name_part}}.o\"\n" | 707 " outputs = [ \"{{source_out_dir}}/{{source_name_part}}.o\" ]\n" |
| 708 " description = \"GCC \\$in\"\n" | 708 " description = \"GCC {{source}}\"\n" |
| 709 " }\n" | 709 " }\n" |
| 710 " tool(\"cxx\") {\n" | 710 " tool(\"cxx\") {\n" |
| 711 " command = \"g++ \\$in -o \\$out\"\n" | 711 " command = \"g++ {{source}} -o {{output}}\"\n" |
| 712 " outputs = [ \"{{source_out_dir}}/{{source_name_part}}.o\"\n" | 712 " outputs = [ \"{{source_out_dir}}/{{source_name_part}}.o\" ]\n" |
| 713 " description = \"G++ \\$in\"\n" | 713 " description = \"G++ {{source}}\"\n" |
| 714 " }\n" | 714 " }\n" |
| 715 " }\n"; | 715 " }\n"; |
| 716 | 716 |
| 717 Value RunTool(Scope* scope, | 717 Value RunTool(Scope* scope, |
| 718 const FunctionCallNode* function, | 718 const FunctionCallNode* function, |
| 719 const std::vector<Value>& args, | 719 const std::vector<Value>& args, |
| 720 BlockNode* block, | 720 BlockNode* block, |
| 721 Err* err) { | 721 Err* err) { |
| 722 // Find the toolchain definition we're executing inside of. The toolchain | 722 // Find the toolchain definition we're executing inside of. The toolchain |
| 723 // function will set a property pointing to it that we'll pick up. | 723 // function will set a property pointing to it that we'll pick up. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 return Value(); | 911 return Value(); |
| 912 | 912 |
| 913 Scope::KeyValueMap values; | 913 Scope::KeyValueMap values; |
| 914 block_scope.GetCurrentScopeValues(&values); | 914 block_scope.GetCurrentScopeValues(&values); |
| 915 toolchain->args() = values; | 915 toolchain->args() = values; |
| 916 | 916 |
| 917 return Value(); | 917 return Value(); |
| 918 } | 918 } |
| 919 | 919 |
| 920 } // namespace functions | 920 } // namespace functions |
| OLD | NEW |