| 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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires | 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires |
| 6 # some enhancements since the commands on Mac are slightly different than on | 6 # some enhancements since the commands on Mac are slightly different than on |
| 7 # Linux. | 7 # Linux. |
| 8 | 8 |
| 9 import("../goma.gni") | 9 import("../goma.gni") |
| 10 import("//build/config/clang/clang.gni") | 10 import("//build/config/clang/clang.gni") |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 # Make these apply to all tools below. | 95 # Make these apply to all tools below. |
| 96 lib_switch = "-l" | 96 lib_switch = "-l" |
| 97 lib_dir_switch = "-L" | 97 lib_dir_switch = "-L" |
| 98 | 98 |
| 99 # Object files go in this directory. Use label_name instead of | 99 # Object files go in this directory. Use label_name instead of |
| 100 # target_output_name since labels will generally have no spaces and will be | 100 # target_output_name since labels will generally have no spaces and will be |
| 101 # unique in the directory. | 101 # unique in the directory. |
| 102 object_subdir = "{{target_out_dir}}/{{label_name}}" | 102 object_subdir = "{{target_out_dir}}/{{label_name}}" |
| 103 | 103 |
| 104 # If dSYMs are enabled, this flag will be added to the link tools. | 104 # If dSYMs are enabled, this flag will be added to the link tools. |
| 105 if (enable_dsyms) { | 105 if (enable_dsyms && (!is_ios || additional_toolchains == [])) { |
| 106 dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " " | 106 dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " " |
| 107 } else { | 107 } else { |
| 108 dsym_switch = "" | 108 dsym_switch = "" |
| 109 } | 109 } |
| 110 | 110 |
| 111 tool("cc") { | 111 tool("cc") { |
| 112 depfile = "{{output}}.d" | 112 depfile = "{{output}}.d" |
| 113 precompiled_header_type = "gcc" | 113 precompiled_header_type = "gcc" |
| 114 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {
{cflags_c}} -c {{source}} -o {{output}}" | 114 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {
{cflags_c}} -c {{source}} -o {{output}}" |
| 115 depsformat = "gcc" | 115 depsformat = "gcc" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 # Tell GN about the output files. It will link to the dylib but use the | 225 # Tell GN about the output files. It will link to the dylib but use the |
| 226 # tocname for dependency management. | 226 # tocname for dependency management. |
| 227 outputs = [ | 227 outputs = [ |
| 228 dylib, | 228 dylib, |
| 229 tocname, | 229 tocname, |
| 230 ] | 230 ] |
| 231 link_output = dylib | 231 link_output = dylib |
| 232 depend_output = tocname | 232 depend_output = tocname |
| 233 | 233 |
| 234 if (enable_dsyms) { | 234 if (enable_dsyms && (!is_ios || additional_toolchains == [])) { |
| 235 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}
}.dSYM/" ] | 235 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}
}.dSYM/" ] |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 tool("solink_module") { | 239 tool("solink_module") { |
| 240 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" | 240 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" |
| 241 rspfile = sofile + ".rsp" | 241 rspfile = sofile + ".rsp" |
| 242 | 242 |
| 243 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,
-filelist,\"$rspfile\"" | 243 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,
-filelist,\"$rspfile\"" |
| 244 if (is_component_build) { | 244 if (is_component_build) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 255 # Use this for {{output_extension}} expansions unless a target manually | 255 # Use this for {{output_extension}} expansions unless a target manually |
| 256 # overrides it (in which case {{output_extension}} will be what the target | 256 # overrides it (in which case {{output_extension}} will be what the target |
| 257 # specifies). | 257 # specifies). |
| 258 default_output_dir = "{{root_out_dir}}" | 258 default_output_dir = "{{root_out_dir}}" |
| 259 default_output_extension = ".so" | 259 default_output_extension = ".so" |
| 260 | 260 |
| 261 outputs = [ | 261 outputs = [ |
| 262 sofile, | 262 sofile, |
| 263 ] | 263 ] |
| 264 | 264 |
| 265 if (enable_dsyms) { | 265 if (enable_dsyms && (!is_ios || additional_toolchains == [])) { |
| 266 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}
}.dSYM/" ] | 266 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}
}.dSYM/" ] |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 tool("link") { | 270 tool("link") { |
| 271 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 271 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| 272 rspfile = "$outfile.rsp" | 272 rspfile = "$outfile.rsp" |
| 273 | 273 |
| 274 # Note about --filelist: Apple's linker reads the file list file and | 274 # Note about --filelist: Apple's linker reads the file list file and |
| 275 # interprets each newline-separated chunk of text as a file name. It | 275 # interprets each newline-separated chunk of text as a file name. It |
| 276 # doesn't do the things one would expect from the shell like unescaping | 276 # doesn't do the things one would expect from the shell like unescaping |
| 277 # or handling quotes. In contrast, when Ninja finds a file name with | 277 # or handling quotes. In contrast, when Ninja finds a file name with |
| 278 # spaces, it single-quotes them in $inputs_newline as it would normally | 278 # spaces, it single-quotes them in $inputs_newline as it would normally |
| 279 # do for command-line arguments. Thus any source names with spaces, or | 279 # do for command-line arguments. Thus any source names with spaces, or |
| 280 # label names with spaces (which GN bases the output paths on) will be | 280 # label names with spaces (which GN bases the output paths on) will be |
| 281 # corrupted by this process. Don't use spaces for source files or labels. | 281 # corrupted by this process. Don't use spaces for source files or labels. |
| 282 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" | 282 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
| 283 description = "LINK $outfile" | 283 description = "LINK $outfile" |
| 284 rspfile_content = "{{inputs_newline}}" | 284 rspfile_content = "{{inputs_newline}}" |
| 285 outputs = [ | 285 outputs = [ |
| 286 outfile, | 286 outfile, |
| 287 ] | 287 ] |
| 288 | 288 |
| 289 if (enable_dsyms) { | 289 if (enable_dsyms && (!is_ios || additional_toolchains == [])) { |
| 290 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}
}.dSYM/" ] | 290 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}
}.dSYM/" ] |
| 291 } | 291 } |
| 292 | 292 |
| 293 default_output_dir = "{{root_out_dir}}" | 293 default_output_dir = "{{root_out_dir}}" |
| 294 } | 294 } |
| 295 | 295 |
| 296 # These two are really entirely generic, but have to be repeated in | 296 # These two are really entirely generic, but have to be repeated in |
| 297 # each toolchain because GN doesn't allow a template to be used here. | 297 # each toolchain because GN doesn't allow a template to be used here. |
| 298 # See //build/toolchain/toolchain.gni for details. | 298 # See //build/toolchain/toolchain.gni for details. |
| 299 tool("stamp") { | 299 tool("stamp") { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 mac_toolchain("ios_clang_x86") { | 387 mac_toolchain("ios_clang_x86") { |
| 388 toolchain_cpu = "x86" | 388 toolchain_cpu = "x86" |
| 389 toolchain_os = "ios" | 389 toolchain_os = "ios" |
| 390 } | 390 } |
| 391 | 391 |
| 392 mac_toolchain("ios_clang_x64") { | 392 mac_toolchain("ios_clang_x64") { |
| 393 toolchain_cpu = "x64" | 393 toolchain_cpu = "x64" |
| 394 toolchain_os = "ios" | 394 toolchain_os = "ios" |
| 395 } | 395 } |
| OLD | NEW |