Updates from make

Contains equivalent changes for:

  561b4c1 Set mcpu targets based on cpu variant.
  6a66a88 Stop encoding absolute paths in symbols
  63e3b02 Enable color output from gcc and clang
  eb3e3fa Use exported includes for libc++.
  3a0a891 Link libgtest_main before libgtest

Change-Id: I45a06c02e9af1d40f0c52f1e6a20d6cd382a27fb
diff --git a/cc/clang.go b/cc/clang.go
index 92061f3..6762247 100644
--- a/cc/clang.go
+++ b/cc/clang.go
@@ -6,7 +6,7 @@
 )
 
 // Cflags that should be filtered out when compiling with clang
-var clangUnknownCflags = []string{
+var clangUnknownCflags = sorted([]string{
 	"-finline-functions",
 	"-finline-limit=64",
 	"-fno-canonical-system-headers",
@@ -30,6 +30,8 @@
 	"-Wno-unused-local-typedefs",
 	"-Wunused-but-set-parameter",
 	"-Wunused-but-set-variable",
+	"-fdiagnostics-color",
+	"-fdebug-prefix-map=/proc/self/cwd=",
 
 	// arm + arm64 + mips + mips64
 	"-fgcse-after-reload",
@@ -61,11 +63,9 @@
 	"-fno-inline-functions-called-once",
 	"-mfpmath=sse",
 	"-mbionic",
-}
+})
 
 func init() {
-	sort.Strings(clangUnknownCflags)
-
 	pctx.StaticVariable("clangExtraCflags", strings.Join([]string{
 		"-D__compiler_offsetof=__builtin_offsetof",
 
@@ -88,6 +88,10 @@
 		// Disable -Winconsistent-missing-override until we can clean up the existing
 		// codebase for it.
 		"-Wno-inconsistent-missing-override",
+
+		// Force clang to always output color diagnostics. Ninja will strip the ANSI
+		// color codes if it is not running in a terminal.
+		"-fcolor-diagnostics",
 	}, " "))
 
 	pctx.StaticVariable("clangExtraConlyflags", strings.Join([]string{
@@ -120,3 +124,8 @@
 	}
 	return false
 }
+
+func sorted(list []string) []string {
+	sort.Strings(list)
+	return list
+}