| 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/err.h" | 5 #include "tools/gn/err.h" |
| 6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
| 7 #include "tools/gn/parse_tree.h" | 7 #include "tools/gn/parse_tree.h" |
| 8 #include "tools/gn/scheduler.h" | 8 #include "tools/gn/scheduler.h" |
| 9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
| 10 #include "tools/gn/settings.h" | 10 #include "tools/gn/settings.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 "tool: Specify arguments to a toolchain tool."; | 153 "tool: Specify arguments to a toolchain tool."; |
| 154 const char kTool_Help[] = | 154 const char kTool_Help[] = |
| 155 "tool: Specify arguments to a toolchain tool.\n" | 155 "tool: Specify arguments to a toolchain tool.\n" |
| 156 "\n" | 156 "\n" |
| 157 " tool(<command type>) { <command flags> }\n" | 157 " tool(<command type>) { <command flags> }\n" |
| 158 "\n" | 158 "\n" |
| 159 " Used inside a toolchain definition to define a command to run for a\n" | 159 " Used inside a toolchain definition to define a command to run for a\n" |
| 160 " given file type. See also \"gn help toolchain\".\n" | 160 " given file type. See also \"gn help toolchain\".\n" |
| 161 "\n" | 161 "\n" |
| 162 "Command types:\n" | 162 "Command types:\n" |
| 163 "\n" |
| 163 " The following values may be passed to the tool() function for the type\n" | 164 " The following values may be passed to the tool() function for the type\n" |
| 164 " of the command:\n" | 165 " of the command:\n" |
| 165 "\n" | 166 "\n" |
| 166 " \"cc\", \"cxx\", \"objc\", \"objcxx\", \"asm\", \"alink\", \"solink\",\n" | 167 " \"cc\", \"cxx\", \"objc\", \"objcxx\", \"asm\", \"alink\", \"solink\",\n" |
| 167 " \"link\", \"stamp\", \"copy\"\n" | 168 " \"link\", \"stamp\", \"copy\"\n" |
| 168 "\n" | 169 "\n" |
| 169 "Command flags:\n" | 170 "Command flags\n" |
| 170 "\n" | 171 "\n" |
| 171 " These variables may be specified in the { } block after the tool call.\n" | 172 " These variables may be specified in the { } block after the tool call.\n" |
| 172 " They are passed directly to Ninja. See the ninja documentation for how\n" | 173 " They are passed directly to Ninja. See the ninja documentation for how\n" |
| 173 " they work. Don't forget to backslash-escape $ required by Ninja to\n" | 174 " they work. Don't forget to backslash-escape $ required by Ninja to\n" |
| 174 " prevent GN from doing variable expansion.\n" | 175 " prevent GN from doing variable expansion.\n" |
| 175 "\n" | 176 "\n" |
| 176 " command, depfile, depsformat, description, pool, restat, rspfile,\n" | 177 " command, depfile, depsformat, description, pool, restat, rspfile,\n" |
| 177 " rspfile_content\n" | 178 " rspfile_content\n" |
| 178 "\n" | 179 "\n" |
| 179 " (Note that GN uses \"depsformat\" for Ninja's \"deps\" variable to\n" | 180 " (Note that GN uses \"depsformat\" for Ninja's \"deps\" variable to\n" |
| 180 " avoid confusion with dependency lists.)\n" | 181 " avoid confusion with dependency lists.)\n" |
| 181 "\n" | 182 "\n" |
| 182 " Additionally, lib_prefix and lib_dir_prefix may be used for the link\n" | 183 " Additionally, lib_prefix and lib_dir_prefix may be used for the link\n" |
| 183 " tools. These strings will be prepended to the libraries and library\n" | 184 " tools. These strings will be prepended to the libraries and library\n" |
| 184 " search directories, respectively, because linkers differ on how to\n" | 185 " search directories, respectively, because linkers differ on how to\n" |
| 185 " specify them.\n" | 186 " specify them.\n" |
| 186 "\n" | 187 "\n" |
| 187 " Note: On Mac libraries with names ending in \".framework\" will be\n" | 188 " Note: On Mac libraries with names ending in \".framework\" will be\n" |
| 188 " added to the link like with a \"-framework\" switch and the lib prefix\n" | 189 " added to the link like with a \"-framework\" switch and the lib prefix\n" |
| 189 " will be ignored.\n" | 190 " will be ignored.\n" |
| 190 "\n" | 191 "\n" |
| 191 "Example:\n" | 192 "Ninja variables available to tool invocations\n" |
| 193 "\n" |
| 194 " When writing tool commands, you use the various built-in Ninja\n" |
| 195 " variables like \"$in\" and \"$out\" (note that the $ must be escaped\n" |
| 196 " for it to be passed to Ninja, so write \"\\$in\" in the command\n" |
| 197 " string).\n" |
| 198 "\n" |
| 199 " GN defines the following variables for binary targets to access the\n" |
| 200 " various computed information needed for compiling:\n" |
| 201 "\n" |
| 202 " - Compiler flags: \"cflags\", \"cflags_c\", \"cflags_cc\",\n" |
| 203 " \"cflags_objc\", \"cflags_objcc\"\n" |
| 204 "\n" |
| 205 " - Linker flags: \"ldflags\", \"libs\"\n" |
| 206 "\n" |
| 207 " GN sets these other variables with target information that can be\n" |
| 208 " used for computing names for supplimetary files:\n" |
| 209 "\n" |
| 210 " - \"target_name\": The name of the current target with no\n" |
| 211 " path information. For example \"mylib\".\n" |
| 212 "\n" |
| 213 " - \"target_out_dir\": The value of \"target_out_dir\" from the BUILD\n" |
| 214 " file for this target (see \"gn help target_out_dir\"), relative\n" |
| 215 " to the root build directory with no trailing slash.\n" |
| 216 "\n" |
| 217 " - \"root_out_dir\": The value of \"root_out_dir\" from the BUILD\n" |
| 218 " file for this target (see \"gn help root_out_dir\"), relative\n" |
| 219 " to the root build directory with no trailing slash.\n" |
| 220 "\n" |
| 221 "Example\n" |
| 222 "\n" |
| 192 " toolchain(\"my_toolchain\") {\n" | 223 " toolchain(\"my_toolchain\") {\n" |
| 193 " # Put these at the top to apply to all tools below.\n" | 224 " # Put these at the top to apply to all tools below.\n" |
| 194 " lib_prefix = \"-l\"\n" | 225 " lib_prefix = \"-l\"\n" |
| 195 " lib_dir_prefix = \"-L\"\n" | 226 " lib_dir_prefix = \"-L\"\n" |
| 196 "\n" | 227 "\n" |
| 197 " tool(\"cc\") {\n" | 228 " tool(\"cc\") {\n" |
| 198 " command = \"gcc \\$in -o \\$out\"\n" | 229 " command = \"gcc \\$in -o \\$out\"\n" |
| 199 " description = \"GCC \\$in\"\n" | 230 " description = \"GCC \\$in\"\n" |
| 200 " }\n" | 231 " }\n" |
| 201 " tool(\"cxx\") {\n" | 232 " tool(\"cxx\") {\n" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 return Value(); | 362 return Value(); |
| 332 | 363 |
| 333 Scope::KeyValueMap values; | 364 Scope::KeyValueMap values; |
| 334 block_scope.GetCurrentScopeValues(&values); | 365 block_scope.GetCurrentScopeValues(&values); |
| 335 toolchain->args() = values; | 366 toolchain->args() = values; |
| 336 | 367 |
| 337 return Value(); | 368 return Value(); |
| 338 } | 369 } |
| 339 | 370 |
| 340 } // namespace functions | 371 } // namespace functions |
| OLD | NEW |