| 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 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 # This will copy the gyp-mac-tool to the build directory. We pass in the source | 52 # This will copy the gyp-mac-tool to the build directory. We pass in the source |
| 53 # file of the win tool. | 53 # file of the win tool. |
| 54 gyp_mac_tool_source = | 54 gyp_mac_tool_source = |
| 55 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir) | 55 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir) |
| 56 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ], "value") | 56 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ], "value") |
| 57 | 57 |
| 58 # Shared toolchain definition. Invocations should set toolchain_os to set the | 58 # Shared toolchain definition. Invocations should set toolchain_os to set the |
| 59 # build args in this definition. | 59 # build args in this definition. |
| 60 template("mac_clang_toolchain") { | 60 template("mac_clang_toolchain") { |
| 61 toolchain(target_name) { | 61 toolchain(target_name) { |
| 62 assert(defined(invoker.cc), |
| 63 "mac_clang_toolchain() must specify a \"cc\" value") |
| 64 assert(defined(invoker.cxx), |
| 65 "mac_clang_toolchain() must specify a \"cxx\" value") |
| 66 assert(defined(invoker.ld), |
| 67 "mac_clang_toolchain() must specify a \"ld\" value") |
| 68 assert(defined(invoker.toolchain_os), |
| 69 "mac_clang_toolchain() must specify a \"toolchain_os\"") |
| 70 |
| 71 # We can't do string interpolation ($ in strings) on things with dots in |
| 72 # them. To allow us to use $cc below, for example, we create copies of |
| 73 # these values in our scope. |
| 74 cc = invoker.cc |
| 75 cxx = invoker.cxx |
| 76 ld = invoker.ld |
| 77 |
| 62 # Make these apply to all tools below. | 78 # Make these apply to all tools below. |
| 63 lib_prefix = "-l" | 79 lib_prefix = "-l" |
| 64 lib_dir_prefix="-L" | 80 lib_dir_prefix="-L" |
| 65 | 81 |
| 66 tool("cc") { | 82 tool("cc") { |
| 67 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \
$cflags_pch_c -c \$in -o \$out" | 83 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \
$cflags_pch_c -c \$in -o \$out" |
| 68 description = "CC \$out" | 84 description = "CC \$out" |
| 69 depfile = "\$out.d" | 85 depfile = "\$out.d" |
| 70 deps = "gcc" | 86 deps = "gcc" |
| 71 } | 87 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 tool("stamp") { | 133 tool("stamp") { |
| 118 command = "\${postbuilds}touch \$out" | 134 command = "\${postbuilds}touch \$out" |
| 119 description = "STAMP \$out" | 135 description = "STAMP \$out" |
| 120 } | 136 } |
| 121 tool("copy") { | 137 tool("copy") { |
| 122 command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$
out)" | 138 command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$
out)" |
| 123 description = "COPY \$in \$out" | 139 description = "COPY \$in \$out" |
| 124 } | 140 } |
| 125 | 141 |
| 126 toolchain_args() { | 142 toolchain_args() { |
| 127 os = toolchain_os | 143 os = invoker.toolchain_os |
| 128 } | 144 } |
| 129 } | 145 } |
| 130 } | 146 } |
| 131 | 147 |
| 132 # Toolchain representing the target build (either mac or iOS). | 148 # Toolchain representing the target build (either mac or iOS). |
| 133 mac_clang_toolchain("clang") { | 149 mac_clang_toolchain("clang") { |
| 134 toolchain_os = os | 150 toolchain_os = os |
| 135 } | 151 } |
| 136 | 152 |
| 137 # This toolchain provides a way for iOS target compiles to reference targets | 153 # This toolchain provides a way for iOS target compiles to reference targets |
| 138 # compiled for the host system. It just overrides the OS back to "mac". | 154 # compiled for the host system. It just overrides the OS back to "mac". |
| 139 mac_clang_toolchain("host_clang") { | 155 mac_clang_toolchain("host_clang") { |
| 140 toolchain_os = "mac" | 156 toolchain_os = "mac" |
| 141 } | 157 } |
| OLD | NEW |