2016-07-21 19:25:45 +00:00
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
declare_args() {
|
2016-08-26 15:13:04 +00:00
|
|
|
ar = "ar"
|
2016-07-21 19:25:45 +00:00
|
|
|
cc = "cc"
|
|
|
|
cxx = "c++"
|
GN: add extra_cflags et al.
Adding flags to the end of cc or cxx is pretty useful, but these always end up
on the command line before the GN generated flags, thus setting defaults that
GN will override.
For full flexibility we want to be able to add flags after the flags GN has
added, so that custom flags can override _it_.
I've updated the Fast bots with an example here: if we said cc="clang -O3 ...",
that '-O3' would be overriden later by the default Release-mode '-Os'. By
putting it in extra_cflags, we get the last word: our '-O3' overrides the
default '-Os'.
Another good use case is a hypothetical Actually-Shippable-Release mode. Our
Release mode bundles in tons of debug symbols via '-g'. libskia.a is about 10x
larger than it needs to be when built that way, but it helps us debug the bot
failures immensely. To build a libskia.{a,so} that you'd really ship, you can
now set extra_cflags="-g0" to override '-g'. You could set '-march' flags there
too, '-fomit-frame-pointer', etc.
There are lots of flags that won't matter where they end up in the command line.
To keep everything simple I've put them in extra_cflags with the rest. This means
the only time we change 'cc' or 'cxx' in our recipes is to prefix 'ccache'.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241263003
Review-Url: https://codereview.chromium.org/2241263003
2016-08-16 16:31:16 +00:00
|
|
|
|
2016-08-25 21:50:44 +00:00
|
|
|
if (is_android) {
|
2016-08-26 15:13:04 +00:00
|
|
|
ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar"
|
2016-08-25 21:50:44 +00:00
|
|
|
cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang"
|
|
|
|
cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++"
|
|
|
|
}
|
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
windk = ""
|
|
|
|
|
GN: add extra_cflags et al.
Adding flags to the end of cc or cxx is pretty useful, but these always end up
on the command line before the GN generated flags, thus setting defaults that
GN will override.
For full flexibility we want to be able to add flags after the flags GN has
added, so that custom flags can override _it_.
I've updated the Fast bots with an example here: if we said cc="clang -O3 ...",
that '-O3' would be overriden later by the default Release-mode '-Os'. By
putting it in extra_cflags, we get the last word: our '-O3' overrides the
default '-Os'.
Another good use case is a hypothetical Actually-Shippable-Release mode. Our
Release mode bundles in tons of debug symbols via '-g'. libskia.a is about 10x
larger than it needs to be when built that way, but it helps us debug the bot
failures immensely. To build a libskia.{a,so} that you'd really ship, you can
now set extra_cflags="-g0" to override '-g'. You could set '-march' flags there
too, '-fomit-frame-pointer', etc.
There are lots of flags that won't matter where they end up in the command line.
To keep everything simple I've put them in extra_cflags with the rest. This means
the only time we change 'cc' or 'cxx' in our recipes is to prefix 'ccache'.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241263003
Review-Url: https://codereview.chromium.org/2241263003
2016-08-16 16:31:16 +00:00
|
|
|
extra_cflags = ""
|
|
|
|
extra_cflags_c = ""
|
|
|
|
extra_cflags_cc = ""
|
2016-09-01 16:15:44 +00:00
|
|
|
extra_ldflags = ""
|
2016-08-26 20:43:19 +00:00
|
|
|
|
2016-09-20 19:09:12 +00:00
|
|
|
cc_wrapper = ""
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
2016-09-26 15:40:12 +00:00
|
|
|
is_clang = exec_script("is_clang.py",
|
|
|
|
[
|
|
|
|
cc,
|
|
|
|
cxx,
|
|
|
|
],
|
|
|
|
"value")
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("default") {
|
|
|
|
asmflags = []
|
|
|
|
cflags = []
|
|
|
|
cflags_c = []
|
|
|
|
cflags_cc = []
|
|
|
|
defines = []
|
|
|
|
ldflags = []
|
|
|
|
|
|
|
|
if (is_win) {
|
|
|
|
cflags += [
|
|
|
|
"/FS", # Preserve previous PDB behavior.
|
2016-09-16 20:29:57 +00:00
|
|
|
"/bigobj", # Some of our files are bigger than the regular limits.
|
|
|
|
]
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags_c += [ "/TC" ]
|
|
|
|
cflags_cc += [ "/TP" ]
|
|
|
|
defines += [
|
|
|
|
"_HAS_EXCEPTIONS=0",
|
|
|
|
"WIN32_LEAN_AND_MEAN",
|
|
|
|
"NOMINMAX",
|
2016-09-16 20:29:57 +00:00
|
|
|
]
|
2016-09-16 21:44:18 +00:00
|
|
|
} else {
|
|
|
|
cflags += [
|
2016-09-16 20:29:57 +00:00
|
|
|
"-O1",
|
|
|
|
"-fstrict-aliasing",
|
|
|
|
"-fPIC",
|
|
|
|
"-fvisibility=hidden",
|
|
|
|
|
|
|
|
"-Werror",
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Winit-self",
|
|
|
|
"-Wpointer-arith",
|
|
|
|
"-Wsign-compare",
|
|
|
|
"-Wvla",
|
|
|
|
|
|
|
|
"-Wno-deprecated-declarations",
|
|
|
|
"-Wno-unused-parameter",
|
2016-08-25 21:50:44 +00:00
|
|
|
]
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags_cc += [
|
2016-09-16 20:29:57 +00:00
|
|
|
"-std=c++11",
|
|
|
|
"-fno-exceptions",
|
|
|
|
"-fno-threadsafe-statics",
|
|
|
|
"-fvisibility-inlines-hidden",
|
|
|
|
|
|
|
|
"-Wnon-virtual-dtor",
|
2016-08-25 21:50:44 +00:00
|
|
|
]
|
2016-09-26 15:40:12 +00:00
|
|
|
if (is_clang) {
|
|
|
|
cflags += [
|
|
|
|
"-Weverything",
|
|
|
|
"-Wno-unknown-warning-option", # Let older Clangs ignore newer Clangs' warnings.
|
|
|
|
]
|
|
|
|
|
2016-09-27 10:42:47 +00:00
|
|
|
# High priority to fix!
|
|
|
|
cflags += [ "-Wno-over-aligned" ]
|
2016-09-26 15:40:12 +00:00
|
|
|
|
|
|
|
cflags += [
|
|
|
|
"-Wno-cast-align",
|
|
|
|
"-Wno-class-varargs",
|
2016-09-26 19:49:04 +00:00
|
|
|
"-Wno-conditional-uninitialized",
|
2016-09-26 15:40:12 +00:00
|
|
|
"-Wno-conversion",
|
|
|
|
"-Wno-disabled-macro-expansion",
|
|
|
|
"-Wno-documentation",
|
|
|
|
"-Wno-documentation-unknown-command",
|
|
|
|
"-Wno-double-promotion",
|
|
|
|
"-Wno-exit-time-destructors", # TODO: OK outside libskia
|
|
|
|
"-Wno-extra-semi",
|
|
|
|
"-Wno-float-conversion",
|
|
|
|
"-Wno-float-equal",
|
2016-09-26 19:49:04 +00:00
|
|
|
"-Wno-format-nonliteral",
|
2016-09-26 15:40:12 +00:00
|
|
|
"-Wno-global-constructors", # TODO: OK outside libskia
|
|
|
|
"-Wno-gnu-anonymous-struct",
|
|
|
|
"-Wno-gnu-zero-variadic-macro-arguments",
|
|
|
|
"-Wno-missing-prototypes",
|
|
|
|
"-Wno-missing-variable-declarations",
|
|
|
|
"-Wno-nested-anon-types",
|
|
|
|
"-Wno-newline-eof",
|
|
|
|
"-Wno-pedantic",
|
|
|
|
"-Wno-reserved-id-macro",
|
2016-09-26 19:49:04 +00:00
|
|
|
"-Wno-shadow",
|
|
|
|
"-Wno-shift-sign-overflow",
|
2016-09-26 15:40:12 +00:00
|
|
|
"-Wno-sign-conversion",
|
|
|
|
"-Wno-switch-enum",
|
|
|
|
"-Wno-undef",
|
|
|
|
"-Wno-unreachable-code",
|
|
|
|
"-Wno-unreachable-code-break",
|
|
|
|
"-Wno-unreachable-code-return",
|
|
|
|
"-Wno-unused-macros",
|
|
|
|
"-Wno-unused-member-function",
|
|
|
|
]
|
|
|
|
cflags_cc += [
|
|
|
|
"-Wno-abstract-vbase-init",
|
|
|
|
"-Wno-range-loop-analysis",
|
|
|
|
"-Wno-weak-vtables",
|
|
|
|
]
|
|
|
|
|
|
|
|
# We are unlikely to want to fix these.
|
|
|
|
cflags += [
|
2016-09-26 19:49:04 +00:00
|
|
|
"-Wno-covered-switch-default",
|
|
|
|
"-Wno-deprecated",
|
2016-09-26 15:40:12 +00:00
|
|
|
"-Wno-implicit-fallthrough",
|
|
|
|
"-Wno-missing-noreturn",
|
|
|
|
"-Wno-old-style-cast",
|
|
|
|
"-Wno-padded",
|
|
|
|
]
|
|
|
|
cflags_cc += [
|
|
|
|
"-Wno-c++98-compat",
|
|
|
|
"-Wno-c++98-compat-pedantic",
|
2016-09-26 19:49:04 +00:00
|
|
|
"-Wno-undefined-func-template",
|
2016-09-26 15:40:12 +00:00
|
|
|
]
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (current_cpu == "arm") {
|
|
|
|
cflags += [
|
|
|
|
"-march=armv7-a",
|
|
|
|
"-mfpu=neon",
|
|
|
|
"-mthumb",
|
|
|
|
]
|
|
|
|
} else if (current_cpu == "mipsel") {
|
|
|
|
cflags += [
|
|
|
|
"-march=mips32r2",
|
|
|
|
"-mdspr2",
|
|
|
|
]
|
|
|
|
} else if (current_cpu == "x86") {
|
|
|
|
asmflags += [ "-m32" ]
|
|
|
|
cflags += [
|
|
|
|
"-m32",
|
|
|
|
"-msse2",
|
|
|
|
"-mfpmath=sse",
|
|
|
|
]
|
|
|
|
ldflags += [ "-m32" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_android) {
|
|
|
|
asmflags += [
|
|
|
|
"--target=$ndk_target",
|
|
|
|
"-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
|
|
|
|
]
|
|
|
|
cflags += [
|
|
|
|
"--sysroot=$ndk/platforms/$ndk_platform",
|
|
|
|
"--target=$ndk_target",
|
|
|
|
"-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
|
|
|
|
]
|
|
|
|
cflags_cc += [
|
|
|
|
"-isystem$ndk/sources/android/support/include",
|
|
|
|
"-isystem$ndk/sources/cxx-stl/llvm-libc++/libcxx/include",
|
|
|
|
]
|
|
|
|
ldflags += [
|
|
|
|
"--sysroot=$ndk/platforms/$ndk_platform",
|
|
|
|
"--target=$ndk_target",
|
|
|
|
"-B$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin",
|
|
|
|
"-pie",
|
|
|
|
]
|
|
|
|
lib_dirs = [
|
|
|
|
"$ndk/sources/cxx-stl/llvm-libc++/libs/$ndk_stdlib",
|
|
|
|
"$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/lib/gcc/$ndk_target/4.9.x",
|
|
|
|
]
|
|
|
|
|
|
|
|
libs = [
|
|
|
|
# Order matters here! Keep these three in exactly this order.
|
|
|
|
"c++_static",
|
|
|
|
"c++abi",
|
|
|
|
"android_support",
|
|
|
|
]
|
|
|
|
if (target_cpu == "arm") {
|
|
|
|
libs += [ "unwind" ]
|
2016-08-26 15:13:04 +00:00
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_linux) {
|
|
|
|
libs = [ "pthread" ]
|
|
|
|
}
|
2016-08-25 21:50:44 +00:00
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
if (sanitize != "") {
|
|
|
|
# You can either pass the sanitizers directly, e.g. "address,undefined",
|
|
|
|
# or pass one of the couple common aliases used by the bots.
|
|
|
|
sanitizers = sanitize
|
|
|
|
if (sanitize == "ASAN") {
|
|
|
|
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"
|
|
|
|
} else if (sanitize == "TSAN") {
|
|
|
|
sanitizers = "thread"
|
|
|
|
} else if (sanitize == "MSAN") {
|
|
|
|
sanitizers = "memory"
|
2016-09-08 15:39:34 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
cflags += [
|
|
|
|
"-fsanitize=$sanitizers",
|
|
|
|
"-fno-sanitize-recover=$sanitizers",
|
|
|
|
"-fsanitize-blacklist=" + rebase_path("../tools/xsan.blacklist"),
|
|
|
|
]
|
|
|
|
ldflags += [ "-fsanitize=$sanitizers" ]
|
|
|
|
if (sanitizers == "memory") {
|
|
|
|
cflags += [ "-fsanitize-memory-track-origins" ]
|
|
|
|
cflags_cc += [ "-stdlib=libc++" ]
|
|
|
|
ldflags += [ "-stdlib=libc++" ]
|
2016-09-16 20:29:57 +00:00
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config("debug_symbols") {
|
|
|
|
# It's annoying to wait for full debug symbols to push over
|
|
|
|
# to Android devices. -gline-tables-only is a lot slimmer.
|
|
|
|
if (is_android) {
|
|
|
|
cflags = [ "-gline-tables-only" ]
|
|
|
|
} else if (!is_win) {
|
|
|
|
cflags = [ "-g" ]
|
|
|
|
}
|
|
|
|
}
|
2016-09-16 20:29:57 +00:00
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("no_rtti") {
|
|
|
|
if (sanitize != "ASAN") { # -fsanitize=vptr requires RTTI
|
|
|
|
if (!is_win) {
|
|
|
|
cflags_cc = [ "-fno-rtti" ]
|
2016-09-08 15:39:34 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
2016-07-21 19:25:45 +00:00
|
|
|
|
2016-09-16 21:44:18 +00:00
|
|
|
config("release") {
|
|
|
|
if (!is_win) {
|
2016-09-16 20:29:57 +00:00
|
|
|
cflags = [ "-O3" ]
|
|
|
|
}
|
2016-09-16 21:44:18 +00:00
|
|
|
defines = [ "NDEBUG" ]
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config("executable") {
|
|
|
|
if (is_mac) {
|
|
|
|
ldflags = [ "-Wl,-rpath,@loader_path/." ]
|
|
|
|
} else if (is_linux) {
|
2016-09-15 17:44:15 +00:00
|
|
|
ldflags = [
|
|
|
|
"-rdynamic",
|
|
|
|
"-Wl,-rpath,\$ORIGIN",
|
|
|
|
]
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
toolchain("msvc") {
|
2016-09-16 21:44:18 +00:00
|
|
|
vc = "$windk\VC\bin\amd64\cl.exe"
|
2016-09-16 20:29:57 +00:00
|
|
|
vlink = "$windk\VC\bin\amd64\link.exe"
|
2016-09-16 21:44:18 +00:00
|
|
|
vlib = "$windk\VC\bin\amd64\lib.exe"
|
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
# TODO: add a python function that generates the includes using <VSPATH>/win_sdk/bin/SetEnv.<cpu>.json
|
|
|
|
windk_include_dirs = "/I$windk\win_sdk\bin\..\..\win_sdk\Include\10.0.10586.0\um /I$windk\win_sdk\bin\..\..\win_sdk\Include\10.0.10586.0\shared /I$windk\win_sdk\bin\..\..\win_sdk\Include\10.0.10586.0\winrt /I$windk\win_sdk\bin\..\..\win_sdk\Include\10.0.10586.0\ucrt /I$windk\win_sdk\bin\..\..\VC\include /I$windk\win_sdk\bin\..\..\VC\atlmfc\include "
|
|
|
|
|
|
|
|
tool("cc") {
|
|
|
|
rspfile = "{{output}}.rsp"
|
|
|
|
precompiled_header_type = "msvc"
|
|
|
|
pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
|
|
|
|
|
|
|
|
# Label names may have spaces in them so the pdbname must be quoted. The
|
|
|
|
# source and output don't need to be quoted because GN knows they're a
|
|
|
|
# full file name and will quote automatically when necessary.
|
2016-09-16 21:44:18 +00:00
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
command = "$vc /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
|
|
|
|
depsformat = "msvc"
|
|
|
|
description = "CC {{output}}"
|
|
|
|
outputs = [
|
|
|
|
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
|
|
|
|
# "$object_subdir/{{source_name_part}}.obj",
|
|
|
|
]
|
|
|
|
rspfile_content = "$windk_include_dirs {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("cxx") {
|
|
|
|
rspfile = "{{output}}.rsp"
|
|
|
|
precompiled_header_type = "msvc"
|
|
|
|
pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
|
|
|
|
|
|
|
|
# Label names may have spaces in them so the pdbname must be quoted. The
|
|
|
|
# source and output don't need to be quoted because GN knows they're a
|
|
|
|
# full file name and will quote automatically when necessary.
|
|
|
|
command = "$vc /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
|
|
|
|
depsformat = "msvc"
|
|
|
|
description = "C++ {{output}}"
|
|
|
|
outputs = [
|
|
|
|
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
|
|
|
|
]
|
|
|
|
rspfile_content = "$windk_include_dirs {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}"
|
2016-09-16 21:44:18 +00:00
|
|
|
}
|
2016-09-16 20:29:57 +00:00
|
|
|
|
|
|
|
tool("alink") {
|
|
|
|
rspfile = "{{output}}.rsp"
|
2016-09-16 21:44:18 +00:00
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
# gyp_win_tool_path = rebase_path("../third_party/externals/gyp/pylib/gyp/win_tool.py")
|
|
|
|
command = "$vlib /nologo {{arflags}} /OUT:{{output}} @$rspfile"
|
|
|
|
description = "LIB {{output}}"
|
|
|
|
outputs = [
|
|
|
|
# Ignore {{output_extension}} and always use .lib, there's no reason to
|
|
|
|
# allow targets to override this extension on Windows.
|
|
|
|
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
|
|
|
|
]
|
|
|
|
default_output_extension = ".lib"
|
|
|
|
default_output_dir = "{{target_out_dir}}"
|
|
|
|
|
|
|
|
# The use of inputs_newline is to work around a fixed per-line buffer
|
|
|
|
# size in the linker.
|
|
|
|
rspfile_content = "{{inputs_newline}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("link") {
|
|
|
|
exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
|
|
|
|
pdbname = "$exename.pdb"
|
|
|
|
rspfile = "$exename.rsp"
|
|
|
|
|
|
|
|
# gyp_win_tool_path = rebase_path("../third_party/externals/gyp/pylib/gyp/win_tool.py")
|
|
|
|
command = "$vlink /nologo /OUT:$exename /PDB:$pdbname @$rspfile"
|
|
|
|
|
|
|
|
default_output_extension = ".exe"
|
|
|
|
default_output_dir = "{{root_out_dir}}"
|
|
|
|
description = "LINK {{output}}"
|
|
|
|
outputs = [
|
|
|
|
#"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
|
|
|
|
exename,
|
|
|
|
]
|
2016-09-16 21:44:18 +00:00
|
|
|
|
2016-09-16 20:29:57 +00:00
|
|
|
#if (symbol_level != 0) {
|
|
|
|
# outputs += [ pdbname ]
|
|
|
|
#}
|
|
|
|
#runtime_outputs = outputs
|
|
|
|
|
|
|
|
# The use of inputs_newline is to work around a fixed per-line buffer
|
|
|
|
# size in the linker.
|
|
|
|
rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("stamp") {
|
|
|
|
win_stamp_path = rebase_path("win_stamp.py")
|
|
|
|
command = "python $win_stamp_path {{output}}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-21 19:25:45 +00:00
|
|
|
toolchain("gcc_like") {
|
|
|
|
lib_switch = "-l"
|
|
|
|
lib_dir_switch = "-L"
|
|
|
|
|
|
|
|
tool("cc") {
|
|
|
|
depfile = "{{output}}.d"
|
2016-09-20 19:09:12 +00:00
|
|
|
command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs = [
|
|
|
|
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
|
|
|
]
|
2016-08-26 20:43:19 +00:00
|
|
|
description =
|
2016-09-20 19:09:12 +00:00
|
|
|
"$cc_wrapper $cc ... $extra_cflags $extra_cflags_c -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("cxx") {
|
|
|
|
depfile = "{{output}}.d"
|
2016-09-20 19:09:12 +00:00
|
|
|
command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs = [
|
|
|
|
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
|
|
|
]
|
2016-08-26 20:43:19 +00:00
|
|
|
description =
|
2016-09-20 19:09:12 +00:00
|
|
|
"$cc_wrapper $cxx ... $extra_cflags $extra_cflags_cc -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("asm") {
|
|
|
|
depfile = "{{output}}.d"
|
2016-09-20 19:09:12 +00:00
|
|
|
command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs = [
|
|
|
|
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
|
|
|
]
|
2016-09-20 19:09:12 +00:00
|
|
|
description = "$cc_wrapper $cc ... -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("alink") {
|
2016-08-26 15:13:04 +00:00
|
|
|
command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
outputs = [
|
2016-07-29 16:10:31 +00:00
|
|
|
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
|
2016-07-21 19:25:45 +00:00
|
|
|
]
|
|
|
|
default_output_extension = ".a"
|
|
|
|
output_prefix = "lib"
|
2016-08-26 15:13:04 +00:00
|
|
|
description = "$ar {{output}} ..."
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("solink") {
|
|
|
|
soname = "{{target_output_name}}{{output_extension}}"
|
|
|
|
|
|
|
|
rpath = "-Wl,-soname,$soname"
|
|
|
|
if (is_mac) {
|
|
|
|
rpath = "-Wl,-install_name,@rpath/$soname"
|
|
|
|
}
|
|
|
|
|
2016-09-20 19:09:12 +00:00
|
|
|
command = "$cc_wrapper $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath $extra_ldflags -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
outputs = [
|
|
|
|
"{{root_out_dir}}/$soname",
|
|
|
|
]
|
|
|
|
output_prefix = "lib"
|
|
|
|
default_output_extension = ".so"
|
2016-09-20 19:09:12 +00:00
|
|
|
description = "$cc_wrapper $cxx -shared ... $extra_ldflags -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("link") {
|
2016-09-20 19:09:12 +00:00
|
|
|
command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} $extra_ldflags -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
outputs = [
|
|
|
|
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
|
|
|
|
]
|
2016-09-20 19:09:12 +00:00
|
|
|
description = "$cc_wrapper $cxx ... $extra_ldflags -o {{output}}"
|
2016-07-21 19:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("stamp") {
|
|
|
|
command = "touch {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("copy") {
|
|
|
|
command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
|
|
|
|
}
|
|
|
|
}
|