Merge pull request #12127 from jcarrano/color-detect-terminal

makefiles/color: detect if writing to terminal.
This commit is contained in:
Francisco 2019-09-06 15:40:56 +03:00 committed by GitHub
commit e2c91639ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,12 +8,8 @@ COLOR_RESET :=
COLOR_ECHO := /bin/echo COLOR_ECHO := /bin/echo
ifeq ($(CC_NOCOLOR),) ifeq ($(CC_NOCOLOR),)
available_colors:=$(shell tput colors 2> /dev/null) IS_TERMINAL = $(if $(MAKE_TERMOUT),$(MAKE_TERMERR),)
ifeq ($(available_colors),) ifeq ($(IS_TERMINAL),)
CC_NOCOLOR = 1
else ifeq ($(available_colors),-1)
CC_NOCOLOR = 1
else ifeq ($(available_colors),0)
CC_NOCOLOR = 1 CC_NOCOLOR = 1
else else
CC_NOCOLOR = 0 CC_NOCOLOR = 0