| Index: tools/gn/example/build/toolchain/BUILD.gn
|
| diff --git a/tools/gn/example/build/toolchain/BUILD.gn b/tools/gn/example/build/toolchain/BUILD.gn
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..27a1e31dd714d1a5bb420852fac9e6322a473d76
|
| --- /dev/null
|
| +++ b/tools/gn/example/build/toolchain/BUILD.gn
|
| @@ -0,0 +1,78 @@
|
| +# Copyright 2014 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +toolchain("gcc") {
|
| + tool("cc") {
|
| + depfile = "{{output}}.d"
|
| + command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
|
| + depsformat = "gcc"
|
| + description = "CC {{output}}"
|
| + outputs = [
|
| + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
| + ]
|
| + }
|
| +
|
| + tool("cxx") {
|
| + depfile = "{{output}}.d"
|
| + command = "g++ -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
|
| + depsformat = "gcc"
|
| + description = "CXX {{output}}"
|
| + outputs = [
|
| + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
| + ]
|
| + }
|
| +
|
| + tool("alink") {
|
| + rspfile = "{{output}}.rsp"
|
| + command = "rm -f {{output}} && ar rcs {{output}} @$rspfile"
|
| + description = "AR {{target_output_name}}{{output_extension}}"
|
| + rspfile_content = "{{inputs}}"
|
| + outputs = [
|
| + "{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
|
| + ]
|
| + default_output_extension = ".a"
|
| + output_prefix = "lib"
|
| + }
|
| +
|
| + tool("solink") {
|
| + soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
|
| + rspfile = soname + ".rsp"
|
| +
|
| + command = "g++ -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile"
|
| + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
|
| +
|
| + description = "SOLINK $soname"
|
| +
|
| + # Use this for {{output_extension}} expansions unless a target manually
|
| + # overrides it (in which case {{output_extension}} will be what the target
|
| + # specifies).
|
| + default_output_extension = ".so"
|
| +
|
| + outputs = [
|
| + soname,
|
| + ]
|
| + link_output = soname
|
| + depend_output = soname
|
| + output_prefix = "lib"
|
| + }
|
| +
|
| + tool("link") {
|
| + outfile = "{{target_output_name}}{{output_extension}}"
|
| + rspfile = "$outfile.rsp"
|
| + command = "g++ {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
|
| + description = "LINK $outfile"
|
| + rspfile_content = "{{inputs}}"
|
| + outputs = [ outfile ]
|
| + }
|
| +
|
| + tool("stamp") {
|
| + command = "touch {{output}}"
|
| + description = "STAMP {{output}}"
|
| + }
|
| +
|
| + tool("copy") {
|
| + command = "cp -af {{source}} {{output}}"
|
| + description = "COPY {{source}} {{output}}"
|
| + }
|
| +}
|
|
|