| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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/compiler/compiler.gni") | 5 import("//build/config/compiler/compiler.gni") |
| 6 import("//build/config/sysroot.gni") | 6 import("//build/config/sysroot.gni") |
| 7 import("//build/toolchain/gcc_toolchain.gni") | 7 import("//build/toolchain/gcc_toolchain.gni") |
| 8 import("//build/toolchain/cros_toolchain.gni") | 8 import("//build/toolchain/cros_toolchain.gni") |
| 9 | 9 |
| 10 template("cros_target_toolchain") { | 10 # This is the normal toolchain for most targets. |
| 11 gcc_toolchain(target_name) { | 11 gcc_toolchain("target") { |
| 12 assert(defined(invoker.toolchain_args)) | 12 ar = cros_target_ar |
| 13 cc = cros_target_cc |
| 14 cxx = cros_target_cxx |
| 15 ld = cxx |
| 16 if (cros_target_ld != "") { |
| 17 ld = cros_target_ld |
| 18 } |
| 19 if (cros_target_nm != "") { |
| 20 nm = cros_target_nm |
| 21 } |
| 22 if (cros_target_readelf != "") { |
| 23 readelf = cros_target_readelf |
| 24 } |
| 25 extra_cflags = cros_target_extra_cflags |
| 26 extra_cppflags = cros_target_extra_cppflags |
| 27 extra_cxxflags = cros_target_extra_cxxflags |
| 28 extra_ldflags = cros_target_extra_ldflags |
| 13 | 29 |
| 14 # These are args for the template. | |
| 15 ar = cros_target_ar | |
| 16 cc = cros_target_cc | |
| 17 cxx = cros_target_cxx | |
| 18 ld = cxx | |
| 19 if (cros_target_ld != "") { | |
| 20 ld = cros_target_ld | |
| 21 } | |
| 22 if (cros_target_nm != "") { | |
| 23 nm = cros_target_nm | |
| 24 } | |
| 25 if (cros_target_readelf != "") { | |
| 26 readelf = cros_target_readelf | |
| 27 } | |
| 28 extra_cflags = cros_target_extra_cflags | |
| 29 extra_cppflags = cros_target_extra_cppflags | |
| 30 extra_cxxflags = cros_target_extra_cxxflags | |
| 31 extra_ldflags = cros_target_extra_ldflags | |
| 32 | |
| 33 toolchain_args = { | |
| 34 forward_variables_from(invoker.toolchain_args, "*") | |
| 35 | |
| 36 cc_wrapper = "" | |
| 37 | |
| 38 # This will override the default computation for is_clang in the | |
| 39 # secondary toolchain with the value of is_clang in the current toolchain | |
| 40 # (the current toolchain will always be the default toolchain here). | |
| 41 is_clang = is_clang | |
| 42 current_cpu = target_cpu | |
| 43 current_os = "chromeos" | |
| 44 use_debug_fission = use_debug_fission | |
| 45 use_sysroot = use_sysroot | |
| 46 } | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 # This is the normal toolchain for most targets. | |
| 51 cros_target_toolchain("target") { | |
| 52 toolchain_args = { | 30 toolchain_args = { |
| 31 cc_wrapper = "" |
| 32 current_cpu = target_cpu |
| 33 current_os = "chromeos" |
| 34 is_clang = is_clang |
| 35 use_debug_fission = use_debug_fission |
| 36 use_gold = use_gold |
| 37 use_sysroot = use_sysroot |
| 53 } | 38 } |
| 54 } | 39 } |
| 55 | 40 |
| 56 # This is a special toolchain needed just for the nacl_bootstrap target in | 41 # This is a special toolchain needed just for the nacl_bootstrap target in |
| 57 # //native_client/src/trusted/service_runtime/linux. It is identical | 42 # //native_client/src/trusted/service_runtime/linux. It is identical |
| 58 # to ":target" except that it forces use_debug_fission, use_gold, and | 43 # to ":target" except that it forces use_debug_fission, use_gold, and |
| 59 # use_sysroot off. | 44 # use_sysroot off, and allows the user to set different sets of extra flags. |
| 60 cros_target_toolchain("nacl_bootstrap") { | 45 gcc_toolchain("nacl_bootstrap") { |
| 46 ar = cros_target_ar |
| 47 cc = cros_target_cc |
| 48 cxx = cros_target_cxx |
| 49 ld = cxx |
| 50 if (cros_target_ld != "") { |
| 51 ld = cros_target_ld |
| 52 } |
| 53 if (cros_target_nm != "") { |
| 54 nm = cros_target_nm |
| 55 } |
| 56 if (cros_target_readelf != "") { |
| 57 readelf = cros_target_readelf |
| 58 } |
| 59 extra_cflags = cros_nacl_bootstrap_extra_cflags |
| 60 extra_cppflags = cros_nacl_bootstrap_extra_cppflags |
| 61 extra_cxxflags = cros_nacl_bootstrap_extra_cxxflags |
| 62 extra_ldflags = cros_nacl_bootstrap_extra_ldflags |
| 63 |
| 61 toolchain_args = { | 64 toolchain_args = { |
| 65 cc_wrapper = "" |
| 66 current_cpu = target_cpu |
| 67 current_os = "chromeos" |
| 68 is_clang = is_clang |
| 62 use_debug_fission = false | 69 use_debug_fission = false |
| 63 use_gold = false | 70 use_gold = false |
| 64 use_sysroot = false | 71 use_sysroot = false |
| 65 } | 72 } |
| 66 } | 73 } |
| 67 | 74 |
| 68 gcc_toolchain("host") { | 75 gcc_toolchain("host") { |
| 69 # These are args for the template. | 76 # These are args for the template. |
| 70 ar = cros_host_ar | 77 ar = cros_host_ar |
| 71 cc = cros_host_cc | 78 cc = cros_host_cc |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { | 127 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { |
| 121 current_cpu = "x86" | 128 current_cpu = "x86" |
| 122 } else { | 129 } else { |
| 123 current_cpu = "x64" | 130 current_cpu = "x64" |
| 124 } | 131 } |
| 125 v8_current_cpu = v8_target_cpu | 132 v8_current_cpu = v8_target_cpu |
| 126 current_os = "linux" | 133 current_os = "linux" |
| 127 use_sysroot = false | 134 use_sysroot = false |
| 128 } | 135 } |
| 129 } | 136 } |
| OLD | NEW |