Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: build/toolchain/gcc_toolchain.gni

Issue 2288273002: Fix imports in gcc_toolchain.gni to not rely on //tools. (Closed)
Patch Set: Check to make sure enable_resource_whitelist_generation is defined. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/android/config.gni ('k') | chrome/chrome_repack_locales.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/clang/clang.gni") 5 import("//build/config/clang/clang.gni")
6 import("//build/config/nacl/config.gni") 6 import("//build/config/nacl/config.gni")
7 import("//build/config/sanitizers/sanitizers.gni") 7 import("//build/config/sanitizers/sanitizers.gni")
8 import("//build/config/v8_target_cpu.gni") 8 import("//build/config/v8_target_cpu.gni")
9 import("//build/toolchain/cc_wrapper.gni") 9 import("//build/toolchain/cc_wrapper.gni")
10 import("//build/toolchain/goma.gni") 10 import("//build/toolchain/goma.gni")
11 import("//build/toolchain/toolchain.gni") 11 import("//build/toolchain/toolchain.gni")
12 import("//tools/grit/grit_rule.gni")
13 12
14 # This template defines a toolchain for something that works like gcc 13 # This template defines a toolchain for something that works like gcc
15 # (including clang). 14 # (including clang).
16 # 15 #
17 # It requires the following variables specifying the executables to run: 16 # It requires the following variables specifying the executables to run:
18 # - ar 17 # - ar
19 # - cc 18 # - cc
20 # - cxx 19 # - cxx
21 # - ld 20 # - ld
22 # 21 #
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 extra_ldflags = "" 212 extra_ldflags = ""
214 } 213 }
215 214
216 # These library switches can apply to all tools below. 215 # These library switches can apply to all tools below.
217 lib_switch = "-l" 216 lib_switch = "-l"
218 lib_dir_switch = "-L" 217 lib_dir_switch = "-L"
219 218
220 # Object files go in this directory. 219 # Object files go in this directory.
221 object_subdir = "{{target_out_dir}}/{{label_name}}" 220 object_subdir = "{{target_out_dir}}/{{label_name}}"
222 221
222 android_should_whitelist = defined(enable_resource_whitelist_generation) &&
223 enable_resource_whitelist_generation
Dirk Pranke 2016/08/29 16:33:00 This should just import("//build/config/android/co
224
223 tool("cc") { 225 tool("cc") {
224 whitelist_flag = " " 226 whitelist_flag = " "
225 if (enable_resource_whitelist_generation) { 227 if (android_should_whitelist) {
226 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\"" 228 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\""
227 } 229 }
228 depfile = "{{output}}.d" 230 depfile = "{{output}}.d"
229 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di rs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{ output}}" 231 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di rs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{ output}}"
230 depsformat = "gcc" 232 depsformat = "gcc"
231 description = "CC {{output}}" 233 description = "CC {{output}}"
232 outputs = [ 234 outputs = [
233 # The whitelist file is also an output, but ninja does not 235 # The whitelist file is also an output, but ninja does not
234 # currently support multiple outputs for tool("cc"). 236 # currently support multiple outputs for tool("cc").
235 "$object_subdir/{{source_name_part}}.o", 237 "$object_subdir/{{source_name_part}}.o",
236 ] 238 ]
237 compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py", 239 compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
238 root_build_dir) 240 root_build_dir)
239 command = "$python_path \"$compile_wrapper\"$whitelist_flag $command" 241 command = "$python_path \"$compile_wrapper\"$whitelist_flag $command"
240 } 242 }
241 243
242 tool("cxx") { 244 tool("cxx") {
243 whitelist_flag = " " 245 whitelist_flag = " "
244 if (enable_resource_whitelist_generation) { 246 if (android_should_whitelist) {
245 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\"" 247 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\""
246 } 248 }
247 depfile = "{{output}}.d" 249 depfile = "{{output}}.d"
248 command = "$cxx -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_d irs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} - o {{output}}" 250 command = "$cxx -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_d irs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} - o {{output}}"
249 depsformat = "gcc" 251 depsformat = "gcc"
250 description = "CXX {{output}}" 252 description = "CXX {{output}}"
251 outputs = [ 253 outputs = [
252 # The whitelist file is also an output, but ninja does not 254 # The whitelist file is also an output, but ninja does not
253 # currently support multiple outputs for tool("cxx"). 255 # currently support multiple outputs for tool("cxx").
254 "$object_subdir/{{source_name_part}}.o", 256 "$object_subdir/{{source_name_part}}.o",
(...skipping 10 matching lines...) Expand all
265 depsformat = "gcc" 267 depsformat = "gcc"
266 description = "ASM {{output}}" 268 description = "ASM {{output}}"
267 outputs = [ 269 outputs = [
268 "$object_subdir/{{source_name_part}}.o", 270 "$object_subdir/{{source_name_part}}.o",
269 ] 271 ]
270 } 272 }
271 273
272 tool("alink") { 274 tool("alink") {
273 rspfile = "{{output}}.rsp" 275 rspfile = "{{output}}.rsp"
274 whitelist_flag = " " 276 whitelist_flag = " "
275 if (enable_resource_whitelist_generation) { 277 if (android_should_whitelist) {
276 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\"" 278 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\""
277 } 279 }
278 280
279 # This needs a Python script to avoid using simple sh features in this 281 # This needs a Python script to avoid using simple sh features in this
280 # command, in case the host does not use a POSIX shell (e.g. compiling 282 # command, in case the host does not use a POSIX shell (e.g. compiling
281 # POSIX-like toolchains such as NaCl on Windows). 283 # POSIX-like toolchains such as NaCl on Windows).
282 ar_wrapper = 284 ar_wrapper =
283 rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) 285 rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir)
284 command = "$python_path \"$ar_wrapper\"$whitelist_flag --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\"" 286 command = "$python_path \"$ar_wrapper\"$whitelist_flag --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\""
285 description = "AR {{output}}" 287 description = "AR {{output}}"
286 rspfile_content = "{{inputs}}" 288 rspfile_content = "{{inputs}}"
287 outputs = [ 289 outputs = [
288 "{{output_dir}}/{{target_output_name}}{{output_extension}}", 290 "{{output_dir}}/{{target_output_name}}{{output_extension}}",
289 ] 291 ]
290 292
291 # Shared libraries go in the target out directory by default so we can 293 # Shared libraries go in the target out directory by default so we can
292 # generate different targets with the same name and not have them collide. 294 # generate different targets with the same name and not have them collide.
293 default_output_dir = "{{target_out_dir}}" 295 default_output_dir = "{{target_out_dir}}"
294 default_output_extension = ".a" 296 default_output_extension = ".a"
295 output_prefix = "lib" 297 output_prefix = "lib"
296 } 298 }
297 299
298 tool("solink") { 300 tool("solink") {
299 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". 301 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
300 sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir. 302 sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir.
301 rspfile = sofile + ".rsp" 303 rspfile = sofile + ".rsp"
302 pool = "//build/toolchain:link_pool($default_toolchain)" 304 pool = "//build/toolchain:link_pool($default_toolchain)"
303 whitelist_flag = " " 305 whitelist_flag = " "
304 if (enable_resource_whitelist_generation) { 306 if (android_should_whitelist) {
305 whitelist_file = "$sofile.whitelist" 307 whitelist_file = "$sofile.whitelist"
306 whitelist_flag = " --resource-whitelist=\"$whitelist_file\"" 308 whitelist_flag = " --resource-whitelist=\"$whitelist_file\""
307 } 309 }
308 310
309 if (defined(invoker.strip)) { 311 if (defined(invoker.strip)) {
310 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" 312 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname"
311 } else { 313 } else {
312 unstripped_sofile = sofile 314 unstripped_sofile = sofile
313 } 315 }
314 316
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 # Ninja to check if the timestamp actually changed to know if downstream 355 # Ninja to check if the timestamp actually changed to know if downstream
354 # dependencies should be recompiled. 356 # dependencies should be recompiled.
355 restat = true 357 restat = true
356 358
357 # Tell GN about the output files. It will link to the sofile but use the 359 # Tell GN about the output files. It will link to the sofile but use the
358 # tocfile for dependency management. 360 # tocfile for dependency management.
359 outputs = [ 361 outputs = [
360 sofile, 362 sofile,
361 tocfile, 363 tocfile,
362 ] 364 ]
363 if (enable_resource_whitelist_generation) { 365 if (android_should_whitelist) {
364 outputs += [ whitelist_file ] 366 outputs += [ whitelist_file ]
365 } 367 }
366 if (sofile != unstripped_sofile) { 368 if (sofile != unstripped_sofile) {
367 outputs += [ unstripped_sofile ] 369 outputs += [ unstripped_sofile ]
368 } 370 }
369 link_output = sofile 371 link_output = sofile
370 depend_output = tocfile 372 depend_output = tocfile
371 } 373 }
372 374
373 tool("solink_module") { 375 tool("solink_module") {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 forward_variables_from(invoker, [ "strip" ]) 498 forward_variables_from(invoker, [ "strip" ])
497 499
498 toolchain_args = { 500 toolchain_args = {
499 if (defined(invoker.toolchain_args)) { 501 if (defined(invoker.toolchain_args)) {
500 forward_variables_from(invoker.toolchain_args, "*") 502 forward_variables_from(invoker.toolchain_args, "*")
501 } 503 }
502 is_clang = true 504 is_clang = true
503 } 505 }
504 } 506 }
505 } 507 }
OLDNEW
« no previous file with comments | « build/config/android/config.gni ('k') | chrome/chrome_repack_locales.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698