diff --git a/makefiles/cflags.inc.mk b/makefiles/cflags.inc.mk index 2f7cf22e95..c9f21ef4a6 100644 --- a/makefiles/cflags.inc.mk +++ b/makefiles/cflags.inc.mk @@ -15,7 +15,7 @@ OPTIONAL_CFLAGS += -fno-delete-null-pointer-checks # Use colored compiler output if the compiler supports this and if this is not # disabled by the user -ifeq ($(CC_NOCOLOR),0) +ifneq ($(CC_NOCOLOR),1) OPTIONAL_CFLAGS += -fdiagnostics-color endif diff --git a/makefiles/color.inc.mk b/makefiles/color.inc.mk index 5c4d63c94e..3e2b1f9d7d 100644 --- a/makefiles/color.inc.mk +++ b/makefiles/color.inc.mk @@ -7,25 +7,22 @@ COLOR_PURPLE := COLOR_RESET := COLOR_ECHO := /bin/echo -ifeq ($(CC_NOCOLOR),) +# Check if colored output is not disabled by user, i.e: CC_NOCOLOR unset +# or 0 +ifneq ($(CC_NOCOLOR),1) IS_TERMINAL = $(if $(MAKE_TERMOUT),$(MAKE_TERMERR),) - ifeq ($(IS_TERMINAL),) - CC_NOCOLOR = 1 - else - CC_NOCOLOR = 0 - endif -endif - -ifeq ($(CC_NOCOLOR),0) - COLOR_GREEN := \033[1;32m - COLOR_RED := \033[1;31m - COLOR_YELLOW := \033[1;33m - COLOR_PURPLE := \033[1;35m - COLOR_RESET := \033[0m - ifeq ($(OS),Darwin) - COLOR_ECHO := echo -e - SHELL=bash - else - COLOR_ECHO := /bin/echo -e + # Check if terminal support colored output + ifneq ($(IS_TERMINAL),) + COLOR_GREEN := \033[1;32m + COLOR_RED := \033[1;31m + COLOR_YELLOW := \033[1;33m + COLOR_PURPLE := \033[1;35m + COLOR_RESET := \033[0m + ifeq ($(OS),Darwin) + COLOR_ECHO := echo -e + SHELL=bash + else + COLOR_ECHO := /bin/echo -e + endif endif endif