Fix gcc color diagnostics

gcc color diagnostics stopped working when the flag was moved to
TARGET_GLOBAL_CFLAGS, as that gets overwritten by combo/select.mk.  Put
it back in COMMON_GLOBAL_CFLAGS, and then let the windows build filter
it out, similar to the way clang deals with unknown flags.

Change-Id: I2db221edb893d81f199494e7515d1b9282c12fae
diff --git a/core/combo/HOST_CROSS_windows-x86.mk b/core/combo/HOST_CROSS_windows-x86.mk
index f509594..c5a713c 100644
--- a/core/combo/HOST_CROSS_windows-x86.mk
+++ b/core/combo/HOST_CROSS_windows-x86.mk
@@ -53,3 +53,6 @@
 $(combo_var_prefix)EXECUTABLE_SUFFIX := .exe
 
 $(combo_var_prefix)IS_64_BIT :=
+
+# The mingw gcc is 4.8, 4.9 is required for color diagnostics
+$(combo_var_prefix)UNKNOWN_CFLAGS := -fdiagnostics-color
diff --git a/core/config.mk b/core/config.mk
index 0b1c020..5cde8eb 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -122,10 +122,7 @@
 
 # Force gcc to always output color diagnostics.  Ninja will strip the ANSI
 # color codes if it is not running in a terminal.
-# Use host and target GLOBAL_CFLAGS so it doesn't apply to HOST_CROSS, the windows
-# toolchain is still 4.8 and doesn't support color.
-HOST_GLOBAL_CFLAGS += -fdiagnostics-color
-TARGET_GLOBAL_CFLAGS += -fdiagnostics-color
+COMMON_GLOBAL_CFLAGS += -fdiagnostics-color
 
 COMMON_GLOBAL_CPPFLAGS:= -Wsign-promo
 COMMON_RELEASE_CPPFLAGS:=
@@ -625,7 +622,7 @@
 endif
 
 ifdef HOST_CROSS_OS
-HOST_CROSS_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
+HOST_CROSS_GLOBAL_CFLAGS += $(filter-out $(HOST_CROSS_UNKNOWN_CFLAGS),$(COMMON_GLOBAL_CFLAGS))
 HOST_CROSS_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
 HOST_CROSS_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
 HOST_CROSS_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)