OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # This template defines a GCC toolchain. |
| 6 # |
| 7 # It requires the following variables specifying the executables to run: |
| 8 # - cc |
| 9 # - cxx |
| 10 # - ar |
| 11 # - ld |
| 12 # and the following which is used in the toolchain_args |
| 13 # - toolchain_cpu_arch (What "cpu_arch" should be set to when invoking a |
| 14 # build using this toolchain.) |
| 15 # - toolchain_os (What "os" should be set to when invoking a build using this |
| 16 # toolchain.) |
| 17 template("gcc_toolchain") { |
| 18 toolchain(target_name) { |
| 19 # Make these apply to all tools below. |
| 20 lib_prefix = "-l" |
| 21 lib_dir_prefix="-L" |
| 22 |
| 23 tool("cc") { |
| 24 # cflags_pch_c |
| 25 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -
c \$in -o \$out" |
| 26 description = "CC \$out" |
| 27 depfile = "\$out.d" |
| 28 deps = "gcc" |
| 29 } |
| 30 tool("cxx") { |
| 31 # cflags_pch_cc |
| 32 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc
-c \$in -o \$out" |
| 33 description = "CXX \$out" |
| 34 depfile = "\$out.d" |
| 35 deps = "gcc" |
| 36 } |
| 37 tool("alink") { |
| 38 command = "rm -f \$out && $ar rcs \$out \$in" |
| 39 description = "AR \$out" |
| 40 } |
| 41 tool("solink") { |
| 42 command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldfla
gs -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whol
e-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | c
ut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib -Wl,-soname
=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { r
eadelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${
lib}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC
; fi; fi" |
| 43 description = "SOLINK \$lib" |
| 44 #pool = "link_pool" |
| 45 restat = "1" |
| 46 } |
| 47 tool("link") { |
| 48 command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--en
d-group \$libs" |
| 49 description = "LINK \$out" |
| 50 #pool = "link_pool" |
| 51 } |
| 52 tool("stamp") { |
| 53 command = "\${postbuilds}touch \$out" |
| 54 description = "STAMP \$out" |
| 55 } |
| 56 tool("copy") { |
| 57 command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$
out)" |
| 58 description = "COPY \$in \$out" |
| 59 } |
| 60 |
| 61 # When invoking this toolchain not as the default one, these args will be |
| 62 # passed to the build. They are ignored when this is the default toolchain. |
| 63 toolchain_args() { |
| 64 cpu_arch = toolchain_cpu_arch |
| 65 os = toolchain_os |
| 66 } |
| 67 } |
| 68 } |
OLD | NEW |