From dbd43849fb9aeb13ed85bccad453c6388b7f37ed Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 4 Jan 2016 14:31:25 -0800 Subject: [PATCH] Don't force color diagnostics outside of ninja Building with USE_NINJA=false and piping build output to a file will result in ANSI color codes in the build output. Only force ANSI codes on when building with ninja, which strips the ANSI codes when writing build output to a non-TTY. Change-Id: Ifd2fb53799fd99c23b7ad91cdb84d943bf707db0 --- core/clang/config.mk | 2 ++ core/config.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/core/clang/config.mk b/core/clang/config.mk index 756bf497d..842d47d8f 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -50,8 +50,10 @@ CLANG_CONFIG_EXTRA_CPPFLAGS += \ # Force clang to always output color diagnostics. Ninja will strip the ANSI # color codes if it is not running in a terminal. +ifdef BUILDING_WITH_NINJA CLANG_CONFIG_EXTRA_CFLAGS += \ -fcolor-diagnostics +endif CLANG_CONFIG_UNKNOWN_CFLAGS := \ -finline-functions \ diff --git a/core/config.mk b/core/config.mk index 37c781d09..29de2339b 100644 --- a/core/config.mk +++ b/core/config.mk @@ -587,7 +587,9 @@ COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG # Force gcc to always output color diagnostics. Ninja will strip the ANSI # color codes if it is not running in a terminal. +ifdef BUILDING_WITH_NINJA COMMON_GLOBAL_CFLAGS += -fdiagnostics-color +endif COMMON_GLOBAL_CPPFLAGS:= -Wsign-promo COMMON_RELEASE_CPPFLAGS:= -- 2.11.0