OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This template defines a toolchain for something that works like gcc | 5 # This template defines a toolchain for something that works like gcc |
6 # (including clang). | 6 # (including clang). |
7 # | 7 # |
8 # It requires the following variables specifying the executables to run: | 8 # It requires the following variables specifying the executables to run: |
9 # - cc | 9 # - cc |
10 # - cxx | 10 # - cxx |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 # Ninja to check if the timestamp actually changed to know if downstream | 156 # Ninja to check if the timestamp actually changed to know if downstream |
157 # dependencies should be recompiled. | 157 # dependencies should be recompiled. |
158 restat = true | 158 restat = true |
159 | 159 |
160 # Tell GN about the output files. It will link to the sofile but use the | 160 # Tell GN about the output files. It will link to the sofile but use the |
161 # tocfile for dependency management. | 161 # tocfile for dependency management. |
162 outputs = [ | 162 outputs = [ |
163 sofile, | 163 sofile, |
164 tocfile, | 164 tocfile, |
165 ] | 165 ] |
| 166 if (defined(invoker.solink_outputs)) { |
| 167 outputs += invoker.solink_outputs |
| 168 } |
166 link_output = sofile | 169 link_output = sofile |
167 depend_output = tocfile | 170 depend_output = tocfile |
168 } | 171 } |
169 | 172 |
170 tool("link") { | 173 tool("link") { |
171 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" | 174 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" |
172 rspfile = "$outfile.rsp" | 175 rspfile = "$outfile.rsp" |
173 command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solib
s}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" | 176 command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solib
s}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" |
| 177 if (defined(invoker.postlink)) { |
| 178 command += " && " + invoker.postlink |
| 179 } |
174 description = "LINK $outfile" | 180 description = "LINK $outfile" |
175 rspfile_content = "{{inputs}}" | 181 rspfile_content = "{{inputs}}" |
176 outputs = [ outfile ] | 182 outputs = [ outfile ] |
| 183 if (defined(invoker.link_outputs)) { |
| 184 outputs += invoker.link_outputs |
| 185 } |
177 } | 186 } |
178 | 187 |
179 tool("stamp") { | 188 tool("stamp") { |
180 command = "touch {{output}}" | 189 command = "touch {{output}}" |
181 description = "STAMP {{output}}" | 190 description = "STAMP {{output}}" |
182 } | 191 } |
183 | 192 |
184 tool("copy") { | 193 tool("copy") { |
185 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &
& cp -af {{source}} {{output}})" | 194 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &
& cp -af {{source}} {{output}})" |
186 description = "COPY {{source}} {{output}}" | 195 description = "COPY {{source}} {{output}}" |
187 } | 196 } |
188 | 197 |
189 # When invoking this toolchain not as the default one, these args will be | 198 # When invoking this toolchain not as the default one, these args will be |
190 # passed to the build. They are ignored when this is the default toolchain. | 199 # passed to the build. They are ignored when this is the default toolchain. |
191 toolchain_args() { | 200 toolchain_args() { |
192 cpu_arch = invoker.toolchain_cpu_arch | 201 cpu_arch = invoker.toolchain_cpu_arch |
193 os = invoker.toolchain_os | 202 os = invoker.toolchain_os |
194 if (defined(invoker.is_clang)) { | 203 if (defined(invoker.is_clang)) { |
195 is_clang = invoker.is_clang | 204 is_clang = invoker.is_clang |
196 } | 205 } |
197 } | 206 } |
198 | 207 |
199 if (defined(invoker.deps)) { | 208 if (defined(invoker.deps)) { |
200 deps = invoker.deps | 209 deps = invoker.deps |
201 } | 210 } |
202 } | 211 } |
203 } | 212 } |
OLD | NEW |