1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2021 The Chromium Authors 2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file. 4*8975f5c5SAndroid Build Coastguard Worker 5*8975f5c5SAndroid Build Coastguard Workerif (current_toolchain == default_toolchain) { 6*8975f5c5SAndroid Build Coastguard Worker import("//build/toolchain/toolchain.gni") 7*8975f5c5SAndroid Build Coastguard Worker 8*8975f5c5SAndroid Build Coastguard Worker # A toolchain that will capture compiler and linker arguments to a file. 9*8975f5c5SAndroid Build Coastguard Worker toolchain("flagcapture") { 10*8975f5c5SAndroid Build Coastguard Worker tool("cxx") { 11*8975f5c5SAndroid Build Coastguard Worker cxx = rebase_path("argcapture.py", root_build_dir) 12*8975f5c5SAndroid Build Coastguard Worker command = "$cxx {{output}} {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}" 13*8975f5c5SAndroid Build Coastguard Worker outputs = [ "{{root_out_dir}}/{{label_name}}.txt" ] 14*8975f5c5SAndroid Build Coastguard Worker } 15*8975f5c5SAndroid Build Coastguard Worker tool("solink") { 16*8975f5c5SAndroid Build Coastguard Worker solink = rebase_path("argcapture.py", root_build_dir) 17*8975f5c5SAndroid Build Coastguard Worker command = "$solink {{output}} {{ldflags}}" 18*8975f5c5SAndroid Build Coastguard Worker outputs = [ "{{root_out_dir}}/{{label_name}}.txt" ] 19*8975f5c5SAndroid Build Coastguard Worker } 20*8975f5c5SAndroid Build Coastguard Worker tool("alink") { 21*8975f5c5SAndroid Build Coastguard Worker command = "this-should-never-run" 22*8975f5c5SAndroid Build Coastguard Worker outputs = [ "this-will-never-exist" ] 23*8975f5c5SAndroid Build Coastguard Worker } 24*8975f5c5SAndroid Build Coastguard Worker tool("stamp") { 25*8975f5c5SAndroid Build Coastguard Worker command = stamp_command 26*8975f5c5SAndroid Build Coastguard Worker description = stamp_description 27*8975f5c5SAndroid Build Coastguard Worker } 28*8975f5c5SAndroid Build Coastguard Worker } 29*8975f5c5SAndroid Build Coastguard Worker} else if (current_toolchain == "//build/android/native_flags:flagcapture") { 30*8975f5c5SAndroid Build Coastguard Worker # This will record flags from all default configs of the default toolchain. 31*8975f5c5SAndroid Build Coastguard Worker source_set("default_ccflags") { 32*8975f5c5SAndroid Build Coastguard Worker sources = [ "empty.cc" ] 33*8975f5c5SAndroid Build Coastguard Worker } 34*8975f5c5SAndroid Build Coastguard Worker shared_library("default_ldflags") { 35*8975f5c5SAndroid Build Coastguard Worker no_default_deps = true 36*8975f5c5SAndroid Build Coastguard Worker } 37*8975f5c5SAndroid Build Coastguard Worker} 38