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 # This is the normal toolchain for most targets. | 10 # This is the normal toolchain for most targets. |
11 gcc_toolchain("target") { | 11 gcc_toolchain("target") { |
12 ar = cros_target_ar | 12 ar = cros_target_ar |
13 cc = cros_target_cc | 13 cc = cros_target_cc |
14 cxx = cros_target_cxx | 14 cxx = cros_target_cxx |
15 ld = cxx | 15 ld = cxx |
16 if (cros_target_ld != "") { | 16 if (cros_target_ld != "") { |
17 ld = cros_target_ld | 17 ld = cros_target_ld |
18 } | 18 } |
19 if (cros_target_nm != "") { | 19 if (cros_target_nm != "") { |
20 nm = cros_target_nm | 20 nm = cros_target_nm |
21 } | 21 } |
22 if (cros_target_readelf != "") { | 22 if (cros_target_readelf != "") { |
23 readelf = cros_target_readelf | 23 readelf = cros_target_readelf |
24 } | 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 | |
29 | 25 |
30 # These are passed through as toolchain_args. | 26 # These are passed through as toolchain_args. |
31 cc_wrapper = "" | 27 cc_wrapper = "" |
32 is_clang = is_clang | 28 is_clang = is_clang |
33 toolchain_cpu = target_cpu | 29 toolchain_cpu = target_cpu |
34 toolchain_os = "chromeos" | 30 toolchain_os = "chromeos" |
35 use_debug_fission = use_debug_fission | 31 use_debug_fission = use_debug_fission |
36 use_gold = use_gold | 32 use_gold = use_gold |
37 use_sysroot = use_sysroot | 33 use_sysroot = use_sysroot |
38 } | 34 } |
39 | 35 |
40 # This is a special toolchain needed just for the nacl_bootstrap target in | 36 # This is a special toolchain needed just for the nacl_bootstrap target in |
41 # //native_client/src/trusted/service_runtime/linux. It is identical | 37 # //native_client/src/trusted/service_runtime/linux. It is identical |
42 # to ":target" except that it forces use_debug_fission, use_gold, and | 38 # to ":target" except that it forces use_debug_fission, use_gold, and |
43 # use_sysroot off, and allows the user to set different sets of extra flags. | 39 # use_sysroot off, and allows the user to set different sets of extra flags. |
44 gcc_toolchain("nacl_bootstrap") { | 40 gcc_toolchain("nacl_bootstrap") { |
45 ar = cros_target_ar | 41 ar = cros_target_ar |
46 cc = cros_target_cc | 42 cc = cros_target_cc |
47 cxx = cros_target_cxx | 43 cxx = cros_target_cxx |
48 ld = cxx | 44 ld = cxx |
49 if (cros_target_ld != "") { | 45 if (cros_target_ld != "") { |
50 ld = cros_target_ld | 46 ld = cros_target_ld |
51 } | 47 } |
52 if (cros_target_nm != "") { | 48 if (cros_target_nm != "") { |
53 nm = cros_target_nm | 49 nm = cros_target_nm |
54 } | 50 } |
55 if (cros_target_readelf != "") { | 51 if (cros_target_readelf != "") { |
56 readelf = cros_target_readelf | 52 readelf = cros_target_readelf |
57 } | 53 } |
58 extra_cflags = cros_nacl_bootstrap_extra_cflags | |
59 extra_cppflags = cros_nacl_bootstrap_extra_cppflags | |
60 extra_cxxflags = cros_nacl_bootstrap_extra_cxxflags | |
61 extra_ldflags = cros_nacl_bootstrap_extra_ldflags | |
62 | 54 |
63 # These are passed through as toolchain_args. | 55 # These are passed through as toolchain_args. |
64 cc_wrapper = "" | 56 cc_wrapper = "" |
65 is_clang = is_clang | 57 is_clang = is_clang |
66 toolchain_cpu = target_cpu | 58 toolchain_cpu = target_cpu |
67 toolchain_os = "chromeos" | 59 toolchain_os = "chromeos" |
68 use_debug_fission = false | 60 use_debug_fission = false |
69 use_gold = false | 61 use_gold = false |
70 use_sysroot = false | 62 use_sysroot = false |
71 } | 63 } |
72 | 64 |
73 gcc_toolchain("host") { | 65 gcc_toolchain("host") { |
74 # These are args for the template. | 66 # These are args for the template. |
75 ar = cros_host_ar | 67 ar = cros_host_ar |
76 cc = cros_host_cc | 68 cc = cros_host_cc |
77 cxx = cros_host_cxx | 69 cxx = cros_host_cxx |
78 ld = cxx | 70 ld = cxx |
79 if (cros_host_ld != "") { | 71 if (cros_host_ld != "") { |
80 ld = cros_host_ld | 72 ld = cros_host_ld |
81 } | 73 } |
82 if (cros_host_nm != "") { | 74 if (cros_host_nm != "") { |
83 nm = cros_host_nm | 75 nm = cros_host_nm |
84 } | 76 } |
85 if (cros_host_readelf != "") { | 77 if (cros_host_readelf != "") { |
86 readelf = cros_host_readelf | 78 readelf = cros_host_readelf |
87 } | 79 } |
88 extra_cflags = cros_host_extra_cflags | |
89 extra_cppflags = cros_host_extra_cppflags | |
90 extra_cxxflags = cros_host_extra_cxxflags | |
91 extra_ldflags = cros_host_extra_ldflags | |
92 | 80 |
93 # These are passed through as toolchain_args. | 81 # These are passed through as toolchain_args. |
94 cc_wrapper = "" | 82 cc_wrapper = "" |
95 is_clang = cros_host_is_clang | 83 is_clang = cros_host_is_clang |
96 toolchain_cpu = host_cpu | 84 toolchain_cpu = host_cpu |
97 toolchain_os = "linux" | 85 toolchain_os = "linux" |
98 use_sysroot = false | 86 use_sysroot = false |
99 } | 87 } |
100 | 88 |
101 gcc_toolchain("v8_snapshot") { | 89 gcc_toolchain("v8_snapshot") { |
102 # These are args for the template. | 90 # These are args for the template. |
103 ar = cros_v8_snapshot_ar | 91 ar = cros_v8_snapshot_ar |
104 cc = cros_v8_snapshot_cc | 92 cc = cros_v8_snapshot_cc |
105 cxx = cros_v8_snapshot_cxx | 93 cxx = cros_v8_snapshot_cxx |
106 ld = cxx | 94 ld = cxx |
107 if (cros_v8_snapshot_ld != "") { | 95 if (cros_v8_snapshot_ld != "") { |
108 ld = cros_v8_snapshot_ld | 96 ld = cros_v8_snapshot_ld |
109 } | 97 } |
110 if (cros_v8_snapshot_nm != "") { | 98 if (cros_v8_snapshot_nm != "") { |
111 nm = cros_v8_snapshot_nm | 99 nm = cros_v8_snapshot_nm |
112 } | 100 } |
113 if (cros_v8_snapshot_readelf != "") { | 101 if (cros_v8_snapshot_readelf != "") { |
114 readelf = cros_v8_snapshot_readelf | 102 readelf = cros_v8_snapshot_readelf |
115 } | 103 } |
116 extra_cflags = cros_v8_snapshot_extra_cflags | |
117 extra_cppflags = cros_v8_snapshot_extra_cppflags | |
118 extra_cxxflags = cros_v8_snapshot_extra_cxxflags | |
119 extra_ldflags = cros_v8_snapshot_extra_ldflags | |
120 | 104 |
121 # These are passed through as toolchain_args. | 105 # These are passed through as toolchain_args. |
122 cc_wrapper = "" | 106 cc_wrapper = "" |
123 is_clang = cros_v8_snapshot_is_clang | 107 is_clang = cros_v8_snapshot_is_clang |
124 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { | 108 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { |
125 toolchain_cpu = "x86" | 109 toolchain_cpu = "x86" |
126 } else { | 110 } else { |
127 toolchain_cpu = "x64" | 111 toolchain_cpu = "x64" |
128 } | 112 } |
129 v8_toolchain_cpu = v8_target_cpu | 113 v8_toolchain_cpu = v8_target_cpu |
130 toolchain_os = "linux" | 114 toolchain_os = "linux" |
131 use_sysroot = false | 115 use_sysroot = false |
132 } | 116 } |
117 | |
118 config("extra_flags") { | |
brettw
2016/08/03 23:02:14
This should really be in //build/config/cros/BUILD
Dirk Pranke
2016/08/03 23:09:07
Good point. I'll move it.
| |
119 if (current_toolchain == "//build/toolchain/cros:target") { | |
120 cflags = cros_target_extra_cflags | |
121 cppflags = cros_target_extra_cppflags | |
122 cxxflags = cros_target_extra_cxxflags | |
123 ldflags = cros_target_extra_ldflags | |
124 } else if (current_toolchain == "//build/toolchain/cros:host") { | |
125 cflags = cros_host_extra_cflags | |
126 cppflags = cros_host_extra_cppflags | |
127 cxxflags = cros_host_extra_cxxflags | |
128 ldflags = cros_host_extra_ldflags | |
129 } else if (current_toolchain == "//build/toolchain/cros:v8_snapshot") { | |
130 cflags = cros_v8_snapshot_extra_cflags | |
131 cppflags = cros_v8_snapshot_extra_cppflags | |
132 cxxflags = cros_v8_snapshot_extra_cxxflags | |
133 ldflags = cros_v8_snapshot_extra_ldflags | |
134 } else if (current_toolchain == "//build/toolchain/cros:nacl_bootstrap") { | |
135 cflags = cros_nacl_bootstrap_extra_cflags | |
136 cppflags = cros_nacl_bootstrap_extra_cppflags | |
137 cxxflags = cros_nacl_bootstrap_extra_cxxflags | |
138 ldflags = cros_nacl_bootstrap_extra_ldflags | |
139 } else { | |
140 assert(false, | |
141 "Unexpected reference to this config from " + current_toolchain) | |
142 } | |
143 } | |
OLD | NEW |