| OLD | NEW |
| 1 # Copyright 2016 Google Inc. | 1 # Copyright 2016 Google Inc. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 declare_args() { | 6 declare_args() { |
| 7 ar = "ar" | 7 ar = "ar" |
| 8 cc = "cc" | 8 cc = "cc" |
| 9 cxx = "c++" | 9 cxx = "c++" |
| 10 } | 10 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 lib_switch = "-l" | 55 lib_switch = "-l" |
| 56 lib_dir_switch = "-L" | 56 lib_dir_switch = "-L" |
| 57 | 57 |
| 58 tool("cc") { | 58 tool("cc") { |
| 59 depfile = "{{output}}.d" | 59 depfile = "{{output}}.d" |
| 60 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c
flags_c}} -c {{source}} -o {{output}}" | 60 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c
flags_c}} -c {{source}} -o {{output}}" |
| 61 depsformat = "gcc" | 61 depsformat = "gcc" |
| 62 outputs = [ | 62 outputs = [ |
| 63 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 63 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 64 ] | 64 ] |
| 65 description = "$cc ... -o {{output}}" |
| 65 } | 66 } |
| 66 | 67 |
| 67 tool("cxx") { | 68 tool("cxx") { |
| 68 depfile = "{{output}}.d" | 69 depfile = "{{output}}.d" |
| 69 command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{
cflags_cc}} -c {{source}} -o {{output}}" | 70 command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{
cflags_cc}} -c {{source}} -o {{output}}" |
| 70 depsformat = "gcc" | 71 depsformat = "gcc" |
| 71 outputs = [ | 72 outputs = [ |
| 72 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 73 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 73 ] | 74 ] |
| 75 description = "$cxx ... -o {{output}}" |
| 74 } | 76 } |
| 75 | 77 |
| 76 tool("asm") { | 78 tool("asm") { |
| 77 depfile = "{{output}}.d" | 79 depfile = "{{output}}.d" |
| 78 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -
c {{source}} -o {{output}}" | 80 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -
c {{source}} -o {{output}}" |
| 79 depsformat = "gcc" | 81 depsformat = "gcc" |
| 80 outputs = [ | 82 outputs = [ |
| 81 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 83 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
| 82 ] | 84 ] |
| 85 description = "$cc ... -o {{output}}" |
| 83 } | 86 } |
| 84 | 87 |
| 85 tool("alink") { | 88 tool("alink") { |
| 86 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" | 89 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" |
| 87 outputs = [ | 90 outputs = [ |
| 88 "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", | 91 "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", |
| 89 ] | 92 ] |
| 90 default_output_extension = ".a" | 93 default_output_extension = ".a" |
| 91 output_prefix = "lib" | 94 output_prefix = "lib" |
| 95 description = "$ar {{output}} ..." |
| 92 } | 96 } |
| 93 | 97 |
| 94 tool("solink") { | 98 tool("solink") { |
| 95 soname = "{{target_output_name}}{{output_extension}}" | 99 soname = "{{target_output_name}}{{output_extension}}" |
| 96 | 100 |
| 97 rpath = "-Wl,-soname,$soname" | 101 rpath = "-Wl,-soname,$soname" |
| 98 if (is_mac) { | 102 if (is_mac) { |
| 99 rpath = "-Wl,-install_name,@rpath/$soname" | 103 rpath = "-Wl,-install_name,@rpath/$soname" |
| 100 } | 104 } |
| 101 | 105 |
| 102 command = "$cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o
{{output}}" | 106 command = "$cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o
{{output}}" |
| 103 outputs = [ | 107 outputs = [ |
| 104 "{{root_out_dir}}/$soname", | 108 "{{root_out_dir}}/$soname", |
| 105 ] | 109 ] |
| 106 output_prefix = "lib" | 110 output_prefix = "lib" |
| 107 default_output_extension = ".so" | 111 default_output_extension = ".so" |
| 112 description = "$cxx -shared ... -o {{output}}" |
| 108 } | 113 } |
| 109 | 114 |
| 110 tool("link") { | 115 tool("link") { |
| 111 command = "$cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" | 116 command = "$cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" |
| 112 outputs = [ | 117 outputs = [ |
| 113 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 118 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
| 114 ] | 119 ] |
| 120 description = "$cxx ... -o {{output}}" |
| 115 } | 121 } |
| 116 | 122 |
| 117 tool("stamp") { | 123 tool("stamp") { |
| 118 command = "touch {{output}}" | 124 command = "touch {{output}}" |
| 119 } | 125 } |
| 120 | 126 |
| 121 tool("copy") { | 127 tool("copy") { |
| 122 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" | 128 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" |
| 123 } | 129 } |
| 124 } | 130 } |
| OLD | NEW |