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 import("//build/config/nacl/config.gni") | 5 import("//build/config/nacl/config.gni") |
| 6 import("//build/toolchain/ccache.gni") |
| 7 import("//build/toolchain/goma.gni") |
6 | 8 |
7 # This value will be inherited in the toolchain below. | 9 # This value will be inherited in the toolchain below. |
8 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 10 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
9 | 11 |
10 # This template defines a toolchain for something that works like gcc | 12 # This template defines a toolchain for something that works like gcc |
11 # (including clang). | 13 # (including clang). |
12 # | 14 # |
13 # It requires the following variables specifying the executables to run: | 15 # It requires the following variables specifying the executables to run: |
14 # - cc | 16 # - cc |
15 # - cxx | 17 # - cxx |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 toolchain(target_name) { | 53 toolchain(target_name) { |
52 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 54 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
53 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 55 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
54 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 56 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
55 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 57 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
56 assert(defined(invoker.toolchain_cpu), | 58 assert(defined(invoker.toolchain_cpu), |
57 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 59 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
58 assert(defined(invoker.toolchain_os), | 60 assert(defined(invoker.toolchain_os), |
59 "gcc_toolchain() must specify a \"toolchain_os\"") | 61 "gcc_toolchain() must specify a \"toolchain_os\"") |
60 | 62 |
| 63 if (defined(invoker.use_ccache)) { |
| 64 use_ccache = invoker.use_ccache |
| 65 } |
| 66 if (defined(invoker.use_goma)) { |
| 67 use_goma = invoker.use_goma |
| 68 } |
| 69 if (use_goma) { |
| 70 assert(!use_ccache, "Goma and ccache can't be used together.") |
| 71 compiler_prefix = "$goma_dir/gomacc " |
| 72 } else if (use_ccache) { |
| 73 compiler_prefix = "ccache " |
| 74 } else { |
| 75 compiler_prefix = "" |
| 76 } |
| 77 |
61 # This define changes when the toolchain changes, forcing a rebuild. | 78 # This define changes when the toolchain changes, forcing a rebuild. |
62 # Nothing should ever use this define. | 79 # Nothing should ever use this define. |
63 if (defined(invoker.rebuild_define)) { | 80 if (defined(invoker.rebuild_define)) { |
64 rebuild_string = "-D" + invoker.rebuild_define + " " | 81 rebuild_string = "-D" + invoker.rebuild_define + " " |
65 } else { | 82 } else { |
66 rebuild_string = "" | 83 rebuild_string = "" |
67 } | 84 } |
68 | 85 |
69 # We can't do string interpolation ($ in strings) on things with dots in | 86 # We can't do string interpolation ($ in strings) on things with dots in |
70 # them. To allow us to use $cc below, for example, we create copies of | 87 # them. To allow us to use $cc below, for example, we create copies of |
71 # these values in our scope. | 88 # these values in our scope. |
72 cc = invoker.cc | 89 cc = compiler_prefix + invoker.cc |
73 cxx = invoker.cxx | 90 cxx = compiler_prefix + invoker.cxx |
74 ar = invoker.ar | 91 ar = invoker.ar |
75 ld = invoker.ld | 92 ld = invoker.ld |
76 if (defined(invoker.readelf)) { | 93 if (defined(invoker.readelf)) { |
77 readelf = invoker.readelf | 94 readelf = invoker.readelf |
78 } else { | 95 } else { |
79 readelf = "readelf" | 96 readelf = "readelf" |
80 } | 97 } |
81 if (defined(invoker.nm)) { | 98 if (defined(invoker.nm)) { |
82 nm = invoker.nm | 99 nm = invoker.nm |
83 } else { | 100 } else { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 [ | 272 [ |
256 "is_clang", | 273 "is_clang", |
257 "is_component_build", | 274 "is_component_build", |
258 "is_nacl_glibc", | 275 "is_nacl_glibc", |
259 ]) | 276 ]) |
260 } | 277 } |
261 | 278 |
262 forward_variables_from(invoker, [ "deps" ]) | 279 forward_variables_from(invoker, [ "deps" ]) |
263 } | 280 } |
264 } | 281 } |
OLD | NEW |