Build: bring back color diagnostics
Change-Id: Ifce25b43d7c7246b60941b95ac0a6d892fcf83c6
diff --git a/BUILD.gn b/BUILD.gn
index 4c818a3..8b03250 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1,12 +1,13 @@
import("//build/image/hypervisor.gni")
-group("host_tools") {
+group("arch_images") {
deps = [
":hafnium($arch_toolchain)",
]
}
executable("test") {
+ testonly = true
sources = [
"test.cpp",
]
diff --git a/build/toolchain/arch/BUILD.gn b/build/toolchain/arch/BUILD.gn
index f85c3af..6523339 100644
--- a/build/toolchain/arch/BUILD.gn
+++ b/build/toolchain/arch/BUILD.gn
@@ -76,7 +76,7 @@
cc_toolchain(target_name) {
cc = "clang"
- cflags = "-target ${invoker.target}"
+ cflags = "-target ${invoker.target} -fcolor-diagnostics"
ld = "${invoker.arch_tool_prefix}ld"
toolchain_args = {
@@ -90,6 +90,7 @@
cc_toolchain(target_name) {
cc = "${invoker.arch_tool_prefix}gcc"
+ cflags = "-fdiagnostics-color=always"
ld = "${invoker.arch_tool_prefix}ld"
toolchain_args = {
diff --git a/build/toolchain/host/BUILD.gn b/build/toolchain/host/BUILD.gn
index 0c4e52e..76db0e6 100644
--- a/build/toolchain/host/BUILD.gn
+++ b/build/toolchain/host/BUILD.gn
@@ -5,9 +5,16 @@
assert(defined(invoker.cc), "cc_toolchain() must specify a \"cc\" value")
assert(defined(invoker.cxx), "cc_toolchain() must specify a \"cxx\" value")
+ cc = "${invoker.cc}"
+ cxx = "${invoker.cxx}"
+ if (defined(invoker.cflags)) {
+ cc += " ${invoker.cflags}"
+ cxx += " ${invoker.cflags}"
+ }
+
tool("cc") {
depfile = "{{output}}.d"
- command = "${invoker.cc} -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
+ command = "${cc} -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "CC {{output}}"
outputs = [
@@ -17,7 +24,7 @@
tool("cxx") {
depfile = "{{output}}.d"
- command = "${invoker.cxx} -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
+ command = "${cxx} -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "CXX {{output}}"
outputs = [
@@ -42,7 +49,7 @@
sofile = "{{output_dir}}/$soname"
rspfile = soname + ".rsp"
- command = "${invoker.cxx} -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
+ command = "${cxx} -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
description = "SOLINK $soname"
@@ -67,7 +74,7 @@
tool("link") {
outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
rspfile = "$outfile.rsp"
- command = "${invoker.cxx} {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
+ command = "${cxx} {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
description = "LINK $outfile"
default_output_dir = "{{root_out_dir}}"
rspfile_content = "{{inputs}}"
@@ -93,10 +100,12 @@
ar = "llvm-ar"
cc = "clang"
cxx = "clang++"
+ cflags = "-fcolor-diagnostics"
}
cc_toolchain("gcc") {
ar = "ar"
cc = "gcc"
cxx = "g++"
+ cflags = "-fdiagnostics-color=always"
}