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 3# found in the LICENSE file. 4 5toolchain("gcc") { 6 tool("cc") { 7 depfile = "{{output}}.d" 8 command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" 9 depsformat = "gcc" 10 description = "CC {{output}}" 11 outputs = 12 [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] 13 } 14 15 tool("cxx") { 16 depfile = "{{output}}.d" 17 command = "g++ -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" 18 depsformat = "gcc" 19 description = "CXX {{output}}" 20 outputs = 21 [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] 22 } 23 24 tool("alink") { 25 rspfile = "{{output}}.rsp" 26 command = "rm -f {{output}} && ar rcs {{output}} @$rspfile" 27 description = "AR {{target_output_name}}{{output_extension}}" 28 rspfile_content = "{{inputs}}" 29 outputs = 30 [ "{{target_out_dir}}/{{target_output_name}}{{output_extension}}" ] 31 default_output_extension = ".a" 32 output_prefix = "lib" 33 } 34 35 tool("solink") { 36 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". 37 sofile = "{{output_dir}}/$soname" 38 rspfile = soname + ".rsp" 39 40 command = "g++ -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile" 41 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" 42 43 description = "SOLINK $soname" 44 45 # Use this for {{output_extension}} expansions unless a target manually 46 # overrides it (in which case {{output_extension}} will be what the target 47 # specifies). 48 default_output_extension = ".so" 49 50 # Use this for {{output_dir}} expansions unless a target manually overrides 51 # it (in which case {{output_dir}} will be what the target specifies). 52 default_output_dir = "{{root_out_dir}}" 53 54 outputs = [ sofile ] 55 link_output = sofile 56 depend_output = sofile 57 output_prefix = "lib" 58 } 59 60 tool("link") { 61 outfile = "{{target_output_name}}{{output_extension}}" 62 rspfile = "$outfile.rsp" 63 command = "g++ {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}" 64 description = "LINK $outfile" 65 default_output_dir = "{{root_out_dir}}" 66 rspfile_content = "{{inputs}}" 67 outputs = [ outfile ] 68 } 69 70 tool("stamp") { 71 command = "touch {{output}}" 72 description = "STAMP {{output}}" 73 } 74 75 tool("copy") { 76 command = "cp -af {{source}} {{output}}" 77 description = "COPY {{source}} {{output}}" 78 } 79} 80