Home | History | Annotate | Download | only in linux
      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 cc = "gcc"
      6 cxx = "g++"
      7 ar = "ar"
      8 ld = cxx
      9 
     10 # The toolchains below all issue the same commands with some different flags.
     11 # TODO(brettw) it would be nice to have a different way to express this without
     12 # so much duplication.
     13 cc_command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out"
     14 cxx_command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc -c \$in -o \$out"
     15 alink_command = "rm -f \$out && $ar rcs \$out \$in"
     16 solink_command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -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"
     17 link_command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end-group \$libs"
     18 stamp_command = "\${postbuilds}touch \$out"
     19 copy_command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)"
     20 
     21 # ARM --------------------------------------------------------------------------
     22 
     23 cc = "arm-linux-gnueabi-gcc"
     24 cxx = "arm-linux-gnueabi-g++"
     25 ar = "arm-linux-gnueabi-ar"
     26 ld = cxx
     27 
     28 toolchain("arm") {
     29   # Make these apply to all tools below.
     30   lib_prefix = "-l"
     31   lib_dir_prefix="-L"
     32 
     33   tool("cc") {
     34     # cflags_pch_c
     35     command = cc_command
     36     description = "CC \$out"
     37     depfile = "\$out.d"
     38     deps = "gcc"
     39   }
     40   tool("cxx") {
     41     # cflags_pch_cc
     42     command = cxx_command
     43     description = "CXX \$out"
     44     depfile = "\$out.d"
     45     deps = "gcc"
     46   }
     47   tool("alink") {
     48     command = alink_command
     49     description = "AR \$out"
     50   }
     51   tool("solink") {
     52     command = solink_command
     53     description = "SOLINK \$lib"
     54     #pool = "link_pool"
     55     restat = "1"
     56   }
     57   tool("link") {
     58     command = link_command
     59     description = "LINK \$out"
     60     #pool = "link_pool"
     61   }
     62   tool("stamp") {
     63     command = stamp_command
     64     description = "STAMP \$out"
     65   }
     66   tool("copy") {
     67     command = copy_command
     68     description = "COPY \$in \$out"
     69   }
     70 
     71   # When invoking this toolchain not as the default one, these args will be
     72   # passed to the build. They are ignored when this is the default toolchain.
     73   toolchain_args() {
     74     cpu_arch = "arm"
     75   }
     76 }
     77 
     78 # 32-bit -----------------------------------------------------------------------
     79 
     80 toolchain("32") {
     81   # Make these apply to all tools below.
     82   lib_prefix = "-l"
     83   lib_dir_prefix="-L"
     84 
     85   tool("cc") {
     86     # cflags_pch_c
     87     command = cc_command
     88     description = "CC \$out"
     89     depfile = "\$out.d"
     90     deps = "gcc"
     91   }
     92   tool("cxx") {
     93     # cflags_pch_cc
     94     command = cxx_command
     95     description = "CXX \$out"
     96     depfile = "\$out.d"
     97     deps = "gcc"
     98   }
     99   tool("alink") {
    100     command = alink_command
    101     description = "AR \$out"
    102   }
    103   tool("solink") {
    104     command = solink_command
    105     description = "SOLINK \$lib"
    106     #pool = "link_pool"
    107     restat = "1"
    108   }
    109   tool("link") {
    110     command = link_command
    111     description = "LINK \$out"
    112     #pool = "link_pool"
    113   }
    114   tool("stamp") {
    115     command = stamp_command
    116     description = "STAMP \$out"
    117   }
    118   tool("copy") {
    119     command = copy_command
    120     description = "COPY \$in \$out"
    121   }
    122 
    123   # When invoking this toolchain not as the default one, these args will be
    124   # passed to the build. They are ignored when this is the default toolchain.
    125   toolchain_args() {
    126     cpu_arch = "x32"
    127   }
    128 }
    129 
    130 # 64-bit -----------------------------------------------------------------------
    131 
    132 toolchain("64") {
    133   # Make these apply to all tools below.
    134   lib_prefix = "-l"
    135   lib_dir_prefix="-L"
    136 
    137   tool("cc") {
    138     # cflags_pch_c
    139     command = cc_command
    140     description = "CC \$out"
    141     depfile = "\$out.d"
    142     deps = "gcc"
    143   }
    144   tool("cxx") {
    145     # cflags_pch_cc
    146     command = cxx_command
    147     description = "CXX \$out"
    148     depfile = "\$out.d"
    149     deps = "gcc"
    150   }
    151   tool("alink") {
    152     command = alink_command
    153     description = "AR \$out"
    154   }
    155   tool("solink") {
    156     command = solink_command
    157     description = "SOLINK \$lib"
    158     #pool = "link_pool"
    159     restat = "1"
    160   }
    161   tool("link") {
    162     command = link_command
    163     description = "LINK \$out"
    164     #pool = "link_pool"
    165   }
    166   tool("stamp") {
    167     command = stamp_command
    168     description = "STAMP \$out"
    169   }
    170   tool("copy") {
    171     command = copy_command
    172     description = "COPY \$in \$out"
    173   }
    174 
    175   # When invoking this toolchain not as the default one, these args will be
    176   # passed to the build. They are ignored when this is the default toolchain.
    177   toolchain_args() {
    178     cpu_arch = "x64"
    179   }
    180 }
    181