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 |
11 if (is_android) { | 11 if (is_android) { |
12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" | 12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" |
13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" | 13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" |
14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" | 14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" |
15 } | 15 } |
16 | 16 |
17 windk = "" | 17 windk = "" |
18 | 18 |
19 extra_cflags = "" | 19 extra_cflags = "" |
20 extra_cflags_c = "" | 20 extra_cflags_c = "" |
21 extra_cflags_cc = "" | 21 extra_cflags_cc = "" |
22 extra_ldflags = "" | 22 extra_ldflags = "" |
23 | 23 |
24 compiler_prefix = "" | 24 cc_wrapper = "" |
25 } | 25 } |
26 | 26 |
27 config("default") { | 27 config("default") { |
28 asmflags = [] | 28 asmflags = [] |
29 cflags = [] | 29 cflags = [] |
30 cflags_c = [] | 30 cflags_c = [] |
31 cflags_cc = [] | 31 cflags_cc = [] |
32 defines = [] | 32 defines = [] |
33 ldflags = [] | 33 ldflags = [] |
34 | 34 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 command = "python $win_stamp_path {{output}}" | 289 command = "python $win_stamp_path {{output}}" |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 toolchain("gcc_like") { | 293 toolchain("gcc_like") { |
294 lib_switch = "-l" | 294 lib_switch = "-l" |
295 lib_dir_switch = "-L" | 295 lib_dir_switch = "-L" |
296 | 296 |
297 tool("cc") { | 297 tool("cc") { |
298 depfile = "{{output}}.d" | 298 depfile = "{{output}}.d" |
299 command = "$compiler_prefix $cc -MMD -MF $depfile {{defines}} {{include_dirs
}} {{cflags}} {{cflags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{outp
ut}}" | 299 command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{
cflags}} {{cflags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{output}}" |
300 depsformat = "gcc" | 300 depsformat = "gcc" |
301 outputs = [ | 301 outputs = [ |
302 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 302 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
303 ] | 303 ] |
304 description = | 304 description = |
305 "$compiler_prefix $cc ... $extra_cflags $extra_cflags_c -o {{output}}" | 305 "$cc_wrapper $cc ... $extra_cflags $extra_cflags_c -o {{output}}" |
306 } | 306 } |
307 | 307 |
308 tool("cxx") { | 308 tool("cxx") { |
309 depfile = "{{output}}.d" | 309 depfile = "{{output}}.d" |
310 command = "$compiler_prefix $cxx -MMD -MF $depfile {{defines}} {{include_dir
s}} {{cflags}} {{cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{o
utput}}" | 310 command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {
{cflags}} {{cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{output
}}" |
311 depsformat = "gcc" | 311 depsformat = "gcc" |
312 outputs = [ | 312 outputs = [ |
313 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 313 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
314 ] | 314 ] |
315 description = | 315 description = |
316 "$compiler_prefix $cxx ... $extra_cflags $extra_cflags_cc -o {{output}}" | 316 "$cc_wrapper $cxx ... $extra_cflags $extra_cflags_cc -o {{output}}" |
317 } | 317 } |
318 | 318 |
319 tool("asm") { | 319 tool("asm") { |
320 depfile = "{{output}}.d" | 320 depfile = "{{output}}.d" |
321 command = "$compiler_prefix $cc -MMD -MF $depfile {{defines}} {{include_dirs
}} {{asmflags}} -c {{source}} -o {{output}}" | 321 command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{
asmflags}} -c {{source}} -o {{output}}" |
322 depsformat = "gcc" | 322 depsformat = "gcc" |
323 outputs = [ | 323 outputs = [ |
324 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 324 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
325 ] | 325 ] |
326 description = "$compiler_prefix $cc ... -o {{output}}" | 326 description = "$cc_wrapper $cc ... -o {{output}}" |
327 } | 327 } |
328 | 328 |
329 tool("alink") { | 329 tool("alink") { |
330 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" | 330 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" |
331 outputs = [ | 331 outputs = [ |
332 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 332 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
333 ] | 333 ] |
334 default_output_extension = ".a" | 334 default_output_extension = ".a" |
335 output_prefix = "lib" | 335 output_prefix = "lib" |
336 description = "$ar {{output}} ..." | 336 description = "$ar {{output}} ..." |
337 } | 337 } |
338 | 338 |
339 tool("solink") { | 339 tool("solink") { |
340 soname = "{{target_output_name}}{{output_extension}}" | 340 soname = "{{target_output_name}}{{output_extension}}" |
341 | 341 |
342 rpath = "-Wl,-soname,$soname" | 342 rpath = "-Wl,-soname,$soname" |
343 if (is_mac) { | 343 if (is_mac) { |
344 rpath = "-Wl,-install_name,@rpath/$soname" | 344 rpath = "-Wl,-install_name,@rpath/$soname" |
345 } | 345 } |
346 | 346 |
347 command = "$compiler_prefix $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {
{libs}} $rpath $extra_ldflags -o {{output}}" | 347 command = "$cc_wrapper $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs
}} $rpath $extra_ldflags -o {{output}}" |
348 outputs = [ | 348 outputs = [ |
349 "{{root_out_dir}}/$soname", | 349 "{{root_out_dir}}/$soname", |
350 ] | 350 ] |
351 output_prefix = "lib" | 351 output_prefix = "lib" |
352 default_output_extension = ".so" | 352 default_output_extension = ".so" |
353 description = | 353 description = "$cc_wrapper $cxx -shared ... $extra_ldflags -o {{output}}" |
354 "$compiler_prefix $cxx -shared ... $extra_ldflags -o {{output}}" | |
355 } | 354 } |
356 | 355 |
357 tool("link") { | 356 tool("link") { |
358 command = "$compiler_prefix $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}}
$extra_ldflags -o {{output}}" | 357 command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} $extr
a_ldflags -o {{output}}" |
359 outputs = [ | 358 outputs = [ |
360 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 359 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
361 ] | 360 ] |
362 description = "$compiler_prefix $cxx ... $extra_ldflags -o {{output}}" | 361 description = "$cc_wrapper $cxx ... $extra_ldflags -o {{output}}" |
363 } | 362 } |
364 | 363 |
365 tool("stamp") { | 364 tool("stamp") { |
366 command = "touch {{output}}" | 365 command = "touch {{output}}" |
367 } | 366 } |
368 | 367 |
369 tool("copy") { | 368 tool("copy") { |
370 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" | 369 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" |
371 } | 370 } |
372 } | 371 } |
OLD | NEW |