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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 config("executable") { | 49 config("executable") { |
50 if (is_mac) { | 50 if (is_mac) { |
51 ldflags = [ "-Wl,-rpath,@loader_path/." ] | 51 ldflags = [ "-Wl,-rpath,@loader_path/." ] |
52 } else if (is_linux) { | 52 } else if (is_linux) { |
53 ldflags = [ "-Wl,-rpath,\$ORIGIN" ] | 53 ldflags = [ "-Wl,-rpath,\$ORIGIN" ] |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
| 57 pool("link_pool") { |
| 58 depth = 0 #unlimited |
| 59 } |
| 60 |
57 toolchain("gcc_like") { | 61 toolchain("gcc_like") { |
58 lib_switch = "-l" | 62 lib_switch = "-l" |
59 lib_dir_switch = "-L" | 63 lib_dir_switch = "-L" |
60 | 64 |
61 tool("cc") { | 65 tool("cc") { |
62 depfile = "{{output}}.d" | 66 depfile = "{{output}}.d" |
63 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c
flags_c}} -c {{source}} -o {{output}}" | 67 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c
flags_c}} -c {{source}} -o {{output}}" |
64 depsformat = "gcc" | 68 depsformat = "gcc" |
65 outputs = [ | 69 outputs = [ |
66 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 70 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 rpath = "-Wl,-install_name,@rpath/$soname" | 110 rpath = "-Wl,-install_name,@rpath/$soname" |
107 } | 111 } |
108 | 112 |
109 command = "$cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o
{{output}}" | 113 command = "$cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o
{{output}}" |
110 outputs = [ | 114 outputs = [ |
111 "{{root_out_dir}}/$soname", | 115 "{{root_out_dir}}/$soname", |
112 ] | 116 ] |
113 output_prefix = "lib" | 117 output_prefix = "lib" |
114 default_output_extension = ".so" | 118 default_output_extension = ".so" |
115 description = "$cxx -shared ... -o {{output}}" | 119 description = "$cxx -shared ... -o {{output}}" |
| 120 pool = ":link_pool" |
116 } | 121 } |
117 | 122 |
118 tool("link") { | 123 tool("link") { |
119 command = "$cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" | 124 command = "$cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" |
120 outputs = [ | 125 outputs = [ |
121 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 126 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
122 ] | 127 ] |
123 description = "$cxx ... -o {{output}}" | 128 description = "$cxx ... -o {{output}}" |
| 129 pool = ":link_pool" |
124 } | 130 } |
125 | 131 |
126 tool("stamp") { | 132 tool("stamp") { |
127 command = "touch {{output}}" | 133 command = "touch {{output}}" |
128 } | 134 } |
129 | 135 |
130 tool("copy") { | 136 tool("copy") { |
131 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" | 137 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &&
cp -af {{source}} {{output}})" |
132 } | 138 } |
133 } | 139 } |
OLD | NEW |