blob: b09e1846a4113f912152fd470639ab1673fee94e [file] [log] [blame]
mtklein7fbfbbe2016-07-21 12:25:45 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6declare_args() {
mtklein349cece2016-08-26 08:13:04 -07007 ar = "ar"
mtklein7fbfbbe2016-07-21 12:25:45 -07008 cc = "cc"
9 cxx = "c++"
mtklein8079ba62016-08-16 09:31:16 -070010
mtklein7d6fb2c2016-08-25 14:50:44 -070011 if (is_android) {
mtklein349cece2016-08-26 08:13:04 -070012 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar"
mtklein7d6fb2c2016-08-25 14:50:44 -070013 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang"
14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++"
15 }
16
Mike Klein0f61faa2016-10-11 16:26:57 -040017 windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
herbb6318bf2016-09-16 13:29:57 -070018
Mike Klein121563e2016-10-04 17:09:13 -040019 extra_cflags = []
20 extra_cflags_c = []
21 extra_cflags_cc = []
22 extra_ldflags = []
mtkleincab0bb72016-08-26 13:43:19 -070023
mtklein60b7ab72016-09-20 12:09:12 -070024 cc_wrapper = ""
mtklein7fbfbbe2016-07-21 12:25:45 -070025}
26
Mike Klein461d3282016-10-11 13:51:55 -040027if (!is_win) {
28 is_clang = exec_script("is_clang.py",
29 [
30 cc,
31 cxx,
32 ],
33 "value")
34}
mtkleinf347c512016-09-26 08:40:12 -070035
mtkleinb9be9792016-09-16 14:44:18 -070036config("default") {
37 asmflags = []
38 cflags = []
39 cflags_c = []
40 cflags_cc = []
41 defines = []
42 ldflags = []
43
44 if (is_win) {
45 cflags += [
46 "/FS", # Preserve previous PDB behavior.
herbb6318bf2016-09-16 13:29:57 -070047 "/bigobj", # Some of our files are bigger than the regular limits.
48 ]
mtkleinb9be9792016-09-16 14:44:18 -070049 cflags_c += [ "/TC" ]
50 cflags_cc += [ "/TP" ]
51 defines += [
52 "_HAS_EXCEPTIONS=0",
53 "WIN32_LEAN_AND_MEAN",
54 "NOMINMAX",
herbb6318bf2016-09-16 13:29:57 -070055 ]
Mike Klein0f61faa2016-10-11 16:26:57 -040056 include_dirs = [
Mike Kleind3016832016-10-12 15:52:44 -040057 "$windk/VC/include",
Mike Kleincc300a12016-10-12 16:25:27 -040058
Mike Kleind3016832016-10-12 15:52:44 -040059 # For local builds.
Mike Klein0f61faa2016-10-11 16:26:57 -040060 "$windk/../Windows Kits/10/Include/10.0.10150.0/ucrt",
Mike Klein0f61faa2016-10-11 16:26:57 -040061 "$windk/../Windows Kits/8.1/Include/shared",
Mike Klein3eb71212016-10-11 17:08:53 -040062 "$windk/../Windows Kits/8.1/Include/um",
Mike Kleincc300a12016-10-12 16:25:27 -040063
Mike Kleind3016832016-10-12 15:52:44 -040064 # For builds using win_toolchain asset.
65 "$windk/win_sdk/Include/10.0.10586.0/shared",
66 "$windk/win_sdk/Include/10.0.10586.0/ucrt",
67 "$windk/win_sdk/Include/10.0.10586.0/um",
Mike Klein0f61faa2016-10-11 16:26:57 -040068 ]
Mike Klein3eb71212016-10-11 17:08:53 -040069 lib_dirs = [
Mike Kleind3016832016-10-12 15:52:44 -040070 "$windk/VC/lib/amd64",
Mike Kleincc300a12016-10-12 16:25:27 -040071
Mike Kleind3016832016-10-12 15:52:44 -040072 # For local builds.
Mike Klein3eb71212016-10-11 17:08:53 -040073 "$windk/../Windows Kits/10/Lib/10.0.10150.0/ucrt/x64",
74 "$windk/../Windows Kits/8.1/Lib/winv6.3/um/x64",
Mike Kleincc300a12016-10-12 16:25:27 -040075
Mike Kleind3016832016-10-12 15:52:44 -040076 # For builds using win_toolchain asset.
77 "$windk/win_sdk/Lib/10.0.10586.0/ucrt/x64",
78 "$windk/win_sdk/Lib/10.0.10586.0/um/x64",
Mike Klein3eb71212016-10-11 17:08:53 -040079 ]
mtkleinb9be9792016-09-16 14:44:18 -070080 } else {
81 cflags += [
herbb6318bf2016-09-16 13:29:57 -070082 "-O1",
83 "-fstrict-aliasing",
84 "-fPIC",
85 "-fvisibility=hidden",
mtklein2b3c2a32016-09-08 08:39:34 -070086
herbb6318bf2016-09-16 13:29:57 -070087 "-Werror",
88 "-Wall",
89 "-Wextra",
90 "-Winit-self",
91 "-Wpointer-arith",
92 "-Wsign-compare",
93 "-Wvla",
94
95 "-Wno-deprecated-declarations",
96 "-Wno-unused-parameter",
mtklein2b3c2a32016-09-08 08:39:34 -070097 ]
mtkleinb9be9792016-09-16 14:44:18 -070098 cflags_cc += [
herbb6318bf2016-09-16 13:29:57 -070099 "-std=c++11",
100 "-fno-exceptions",
101 "-fno-threadsafe-statics",
102 "-fvisibility-inlines-hidden",
103
104 "-Wnon-virtual-dtor",
105 ]
mtkleinf347c512016-09-26 08:40:12 -0700106 if (is_clang) {
107 cflags += [
108 "-Weverything",
109 "-Wno-unknown-warning-option", # Let older Clangs ignore newer Clangs' warnings.
110 ]
111
Mike Klein7bfc08b2016-09-27 07:41:45 -0400112 if (is_android && target_cpu == "x86") {
113 # Clang seems to think new/malloc will only be 4-byte aligned on x86 Android.
114 # We're pretty sure it's actually 8-byte alignment.
115 cflags += [ "-Wno-over-aligned" ]
116 }
mtkleinf347c512016-09-26 08:40:12 -0700117
118 cflags += [
119 "-Wno-cast-align",
Mike Klein2cc7f8d2016-09-26 15:49:04 -0400120 "-Wno-conditional-uninitialized",
mtkleinf347c512016-09-26 08:40:12 -0700121 "-Wno-conversion",
122 "-Wno-disabled-macro-expansion",
123 "-Wno-documentation",
124 "-Wno-documentation-unknown-command",
125 "-Wno-double-promotion",
126 "-Wno-exit-time-destructors", # TODO: OK outside libskia
mtkleinf347c512016-09-26 08:40:12 -0700127 "-Wno-float-conversion",
128 "-Wno-float-equal",
Mike Klein2cc7f8d2016-09-26 15:49:04 -0400129 "-Wno-format-nonliteral",
mtkleinf347c512016-09-26 08:40:12 -0700130 "-Wno-global-constructors", # TODO: OK outside libskia
mtkleinf347c512016-09-26 08:40:12 -0700131 "-Wno-gnu-zero-variadic-macro-arguments",
132 "-Wno-missing-prototypes",
133 "-Wno-missing-variable-declarations",
mtkleinf347c512016-09-26 08:40:12 -0700134 "-Wno-pedantic",
135 "-Wno-reserved-id-macro",
Mike Klein2cc7f8d2016-09-26 15:49:04 -0400136 "-Wno-shadow",
137 "-Wno-shift-sign-overflow",
mtkleinf347c512016-09-26 08:40:12 -0700138 "-Wno-sign-conversion",
139 "-Wno-switch-enum",
140 "-Wno-undef",
141 "-Wno-unreachable-code",
142 "-Wno-unreachable-code-break",
143 "-Wno-unreachable-code-return",
144 "-Wno-unused-macros",
145 "-Wno-unused-member-function",
146 ]
147 cflags_cc += [
148 "-Wno-abstract-vbase-init",
149 "-Wno-range-loop-analysis",
150 "-Wno-weak-vtables",
151 ]
152
153 # We are unlikely to want to fix these.
154 cflags += [
Mike Klein2cc7f8d2016-09-26 15:49:04 -0400155 "-Wno-covered-switch-default",
156 "-Wno-deprecated",
mtkleinf347c512016-09-26 08:40:12 -0700157 "-Wno-implicit-fallthrough",
158 "-Wno-missing-noreturn",
159 "-Wno-old-style-cast",
160 "-Wno-padded",
161 ]
162 cflags_cc += [
163 "-Wno-c++98-compat",
164 "-Wno-c++98-compat-pedantic",
Mike Klein2cc7f8d2016-09-26 15:49:04 -0400165 "-Wno-undefined-func-template",
mtkleinf347c512016-09-26 08:40:12 -0700166 ]
167 }
mtkleinb9be9792016-09-16 14:44:18 -0700168 }
herbb6318bf2016-09-16 13:29:57 -0700169
mtkleinb9be9792016-09-16 14:44:18 -0700170 if (current_cpu == "arm") {
171 cflags += [
172 "-march=armv7-a",
173 "-mfpu=neon",
174 "-mthumb",
175 ]
176 } else if (current_cpu == "mipsel") {
177 cflags += [
178 "-march=mips32r2",
179 "-mdspr2",
180 ]
181 } else if (current_cpu == "x86") {
182 asmflags += [ "-m32" ]
183 cflags += [
184 "-m32",
185 "-msse2",
186 "-mfpmath=sse",
187 ]
188 ldflags += [ "-m32" ]
189 }
herbb6318bf2016-09-16 13:29:57 -0700190
mtkleinb9be9792016-09-16 14:44:18 -0700191 if (is_android) {
192 asmflags += [
193 "--target=$ndk_target",
194 "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
195 ]
196 cflags += [
197 "--sysroot=$ndk/platforms/$ndk_platform",
198 "--target=$ndk_target",
199 "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
200 ]
201 cflags_cc += [
202 "-isystem$ndk/sources/android/support/include",
Mike Klein4fdc5432016-10-11 11:21:36 -0400203 "-isystem$ndk/sources/cxx-stl/llvm-libc++/libcxx/include", # Through r12b.
204 "-isystem$ndk/sources/cxx-stl/llvm-libc++/include", # Since r13.
mtkleinb9be9792016-09-16 14:44:18 -0700205 ]
206 ldflags += [
207 "--sysroot=$ndk/platforms/$ndk_platform",
208 "--target=$ndk_target",
209 "-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
210 "-pie",
211 ]
212 lib_dirs = [
213 "$ndk/sources/cxx-stl/llvm-libc++/libs/$ndk_stdlib",
214 "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/lib/gcc/$ndk_target/4.9.x",
215 ]
herbb6318bf2016-09-16 13:29:57 -0700216
Mike Klein4fdc5432016-10-11 11:21:36 -0400217 if (current_cpu == "mips64el") {
218 # The r13 NDK omits /usr/lib from the MIPS64 sysroots, but Clang searches
219 # for /usr/lib64 as $PATH_TO_USR_LIB/../lib64. If there's no /usr/lib,
220 # it can't find /usr/lib64. We must point Clang at /usr/lib64 manually.
221 lib_dirs += [ "$ndk/platforms/$ndk_platform/usr/lib64" ]
222 ldflags += [
223 # Clang will try to link these two files, but not find them. Again, do it manually.
224 "-nostartfiles",
225 "$ndk/platforms/$ndk_platform/usr/lib64/crtbegin_dynamic.o",
226 "$ndk/platforms/$ndk_platform/usr/lib64/crtend_android.o",
227 ]
228 }
229
mtkleinb9be9792016-09-16 14:44:18 -0700230 libs = [
231 # Order matters here! Keep these three in exactly this order.
232 "c++_static",
233 "c++abi",
234 "android_support",
235 ]
236 if (target_cpu == "arm") {
237 libs += [ "unwind" ]
mtklein2b3c2a32016-09-08 08:39:34 -0700238 }
239 }
mtklein7fbfbbe2016-07-21 12:25:45 -0700240
mtkleinb9be9792016-09-16 14:44:18 -0700241 if (is_linux) {
242 libs = [ "pthread" ]
243 }
244
245 if (sanitize != "") {
246 # You can either pass the sanitizers directly, e.g. "address,undefined",
247 # or pass one of the couple common aliases used by the bots.
248 sanitizers = sanitize
249 if (sanitize == "ASAN") {
250 sanitizers = "address,bool,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound,vptr"
251 } else if (sanitize == "TSAN") {
252 sanitizers = "thread"
253 } else if (sanitize == "MSAN") {
254 sanitizers = "memory"
255 }
256
257 cflags += [
258 "-fsanitize=$sanitizers",
259 "-fno-sanitize-recover=$sanitizers",
260 "-fsanitize-blacklist=" + rebase_path("../tools/xsan.blacklist"),
261 ]
262 ldflags += [ "-fsanitize=$sanitizers" ]
263 if (sanitizers == "memory") {
264 cflags += [ "-fsanitize-memory-track-origins" ]
265 cflags_cc += [ "-stdlib=libc++" ]
266 ldflags += [ "-stdlib=libc++" ]
267 }
268 }
269}
270
Mike Klein121563e2016-10-04 17:09:13 -0400271config("extra_flags") {
272 cflags = extra_cflags
273 cflags_c = extra_cflags_c
274 cflags_cc = extra_cflags_cc
275 ldflags = extra_ldflags
276}
277
mtkleinb9be9792016-09-16 14:44:18 -0700278config("debug_symbols") {
279 # It's annoying to wait for full debug symbols to push over
280 # to Android devices. -gline-tables-only is a lot slimmer.
281 if (is_android) {
282 cflags = [ "-gline-tables-only" ]
Mike Kleincc300a12016-10-12 16:25:27 -0400283 } else if (is_win) {
284 cflags = [ "/Zi" ]
285 } else {
mtkleinb9be9792016-09-16 14:44:18 -0700286 cflags = [ "-g" ]
287 }
288}
289
290config("no_rtti") {
291 if (sanitize != "ASAN") { # -fsanitize=vptr requires RTTI
Mike Kleincc300a12016-10-12 16:25:27 -0400292 if (is_win) {
293 cflags_cc = [ "/GR-" ]
294 } else {
mtkleinb9be9792016-09-16 14:44:18 -0700295 cflags_cc = [ "-fno-rtti" ]
296 }
297 }
298}
299
300config("release") {
Mike Kleincc300a12016-10-12 16:25:27 -0400301 if (is_win) {
302 cflags = [ "/O2" ]
303 } else {
herbb6318bf2016-09-16 13:29:57 -0700304 cflags = [ "-O3" ]
herbb6318bf2016-09-16 13:29:57 -0700305 }
mtkleinb9be9792016-09-16 14:44:18 -0700306 defines = [ "NDEBUG" ]
mtklein7fbfbbe2016-07-21 12:25:45 -0700307}
308
309config("executable") {
310 if (is_mac) {
311 ldflags = [ "-Wl,-rpath,@loader_path/." ]
312 } else if (is_linux) {
mtkleina846c722016-09-15 10:44:15 -0700313 ldflags = [
314 "-rdynamic",
315 "-Wl,-rpath,\$ORIGIN",
316 ]
mtklein7fbfbbe2016-07-21 12:25:45 -0700317 }
318}
319
herbb6318bf2016-09-16 13:29:57 -0700320toolchain("msvc") {
Mike Klein3eb71212016-10-11 17:08:53 -0400321 lib_dir_switch = "/LIBPATH:"
322
Mike Klein0f61faa2016-10-11 16:26:57 -0400323 cl_exe = "$windk/VC/bin/amd64/cl.exe"
324 link_exe = "$windk/VC/bin/amd64/link.exe"
325 lib_exe = "$windk/VC/bin/amd64/lib.exe"
herbb6318bf2016-09-16 13:29:57 -0700326
327 tool("cc") {
328 rspfile = "{{output}}.rsp"
329 precompiled_header_type = "msvc"
330 pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
331
Mike Klein0f61faa2016-10-11 16:26:57 -0400332 # Label names may have spaces so pdbname must be quoted.
333 command = "$cl_exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
herbb6318bf2016-09-16 13:29:57 -0700334 depsformat = "msvc"
herbb6318bf2016-09-16 13:29:57 -0700335 outputs = [
336 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
herbb6318bf2016-09-16 13:29:57 -0700337 ]
Mike Klein0f61faa2016-10-11 16:26:57 -0400338 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
herbb6318bf2016-09-16 13:29:57 -0700339 }
340
341 tool("cxx") {
342 rspfile = "{{output}}.rsp"
343 precompiled_header_type = "msvc"
344 pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
345
Mike Klein0f61faa2016-10-11 16:26:57 -0400346 # Label names may have spaces so pdbname must be quoted.
347 command = "$cl_exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
herbb6318bf2016-09-16 13:29:57 -0700348 depsformat = "msvc"
herbb6318bf2016-09-16 13:29:57 -0700349 outputs = [
350 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
351 ]
Mike Klein0f61faa2016-10-11 16:26:57 -0400352 rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}"
mtkleinb9be9792016-09-16 14:44:18 -0700353 }
herbb6318bf2016-09-16 13:29:57 -0700354
355 tool("alink") {
356 rspfile = "{{output}}.rsp"
mtkleinb9be9792016-09-16 14:44:18 -0700357
Mike Klein0f61faa2016-10-11 16:26:57 -0400358 command = "$lib_exe /nologo {{arflags}} /OUT:{{output}} @$rspfile"
herbb6318bf2016-09-16 13:29:57 -0700359 outputs = [
360 # Ignore {{output_extension}} and always use .lib, there's no reason to
361 # allow targets to override this extension on Windows.
362 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
363 ]
364 default_output_extension = ".lib"
365 default_output_dir = "{{target_out_dir}}"
366
Mike Klein0f61faa2016-10-11 16:26:57 -0400367 # inputs_newline works around a fixed per-line buffer size in the linker.
herbb6318bf2016-09-16 13:29:57 -0700368 rspfile_content = "{{inputs_newline}}"
369 }
370
371 tool("link") {
372 exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
373 pdbname = "$exename.pdb"
374 rspfile = "$exename.rsp"
375
Mike Klein0f61faa2016-10-11 16:26:57 -0400376 command = "$link_exe /nologo /OUT:$exename /PDB:$pdbname @$rspfile"
herbb6318bf2016-09-16 13:29:57 -0700377
378 default_output_extension = ".exe"
379 default_output_dir = "{{root_out_dir}}"
herbb6318bf2016-09-16 13:29:57 -0700380 outputs = [
herbb6318bf2016-09-16 13:29:57 -0700381 exename,
382 ]
mtkleinb9be9792016-09-16 14:44:18 -0700383
Mike Klein0f61faa2016-10-11 16:26:57 -0400384 # inputs_newline works around a fixed per-line buffer size in the linker.
herbb6318bf2016-09-16 13:29:57 -0700385 rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
386 }
387
herbb6318bf2016-09-16 13:29:57 -0700388 tool("stamp") {
Mike Kleind3016832016-10-12 15:52:44 -0400389 command = "cmd.exe /c echo > {{output}}"
herbb6318bf2016-09-16 13:29:57 -0700390 }
391}
392
mtklein7fbfbbe2016-07-21 12:25:45 -0700393toolchain("gcc_like") {
394 lib_switch = "-l"
395 lib_dir_switch = "-L"
396
397 tool("cc") {
398 depfile = "{{output}}.d"
Mike Klein121563e2016-10-04 17:09:13 -0400399 command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700400 depsformat = "gcc"
401 outputs = [
402 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
403 ]
Mike Klein121563e2016-10-04 17:09:13 -0400404 description = "$cc_wrapper $cc ... -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700405 }
406
407 tool("cxx") {
408 depfile = "{{output}}.d"
Mike Klein121563e2016-10-04 17:09:13 -0400409 command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700410 depsformat = "gcc"
411 outputs = [
412 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
413 ]
Mike Klein121563e2016-10-04 17:09:13 -0400414 description = "$cc_wrapper $cxx ... -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700415 }
416
417 tool("asm") {
418 depfile = "{{output}}.d"
mtklein60b7ab72016-09-20 12:09:12 -0700419 command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700420 depsformat = "gcc"
421 outputs = [
422 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
423 ]
mtklein60b7ab72016-09-20 12:09:12 -0700424 description = "$cc_wrapper $cc ... -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700425 }
426
427 tool("alink") {
mtklein349cece2016-08-26 08:13:04 -0700428 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700429 outputs = [
mtklein5db44aa2016-07-29 09:10:31 -0700430 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
mtklein7fbfbbe2016-07-21 12:25:45 -0700431 ]
432 default_output_extension = ".a"
433 output_prefix = "lib"
mtklein349cece2016-08-26 08:13:04 -0700434 description = "$ar {{output}} ..."
mtklein7fbfbbe2016-07-21 12:25:45 -0700435 }
436
437 tool("solink") {
438 soname = "{{target_output_name}}{{output_extension}}"
439
440 rpath = "-Wl,-soname,$soname"
441 if (is_mac) {
442 rpath = "-Wl,-install_name,@rpath/$soname"
443 }
444
Mike Klein121563e2016-10-04 17:09:13 -0400445 command = "$cc_wrapper $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700446 outputs = [
447 "{{root_out_dir}}/$soname",
448 ]
449 output_prefix = "lib"
450 default_output_extension = ".so"
Mike Klein121563e2016-10-04 17:09:13 -0400451 description = "$cc_wrapper $cxx -shared ... -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700452 }
453
454 tool("link") {
Mike Klein121563e2016-10-04 17:09:13 -0400455 command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700456 outputs = [
457 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
458 ]
Mike Klein121563e2016-10-04 17:09:13 -0400459 description = "$cc_wrapper $cxx ... -o {{output}}"
mtklein7fbfbbe2016-07-21 12:25:45 -0700460 }
461
462 tool("stamp") {
463 command = "touch {{output}}"
464 }
465
466 tool("copy") {
467 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
468 }
469}