2017-11-11 15:56:55 +01:00
|
|
|
# Set colored output control sequences if the terminal supports it and if
|
|
|
|
# not disabled by the user
|
|
|
|
|
2017-09-09 00:06:29 +02:00
|
|
|
COLOR_GREEN :=
|
|
|
|
COLOR_RED :=
|
2019-08-30 13:55:32 +02:00
|
|
|
COLOR_YELLOW :=
|
2017-09-09 00:06:29 +02:00
|
|
|
COLOR_PURPLE :=
|
|
|
|
COLOR_RESET :=
|
2019-12-27 01:09:53 +01:00
|
|
|
COLOR_ECHO := /usr/bin/env echo
|
2017-09-09 00:06:29 +02:00
|
|
|
|
2020-01-10 08:40:00 +01:00
|
|
|
# Check if colored output is not disabled by user, i.e: CC_NOCOLOR unset
|
|
|
|
# or 0
|
|
|
|
ifneq ($(CC_NOCOLOR),1)
|
2019-08-30 16:30:41 +02:00
|
|
|
IS_TERMINAL = $(if $(MAKE_TERMOUT),$(MAKE_TERMERR),)
|
2020-01-10 08:40:00 +01:00
|
|
|
# Check if terminal support colored output
|
|
|
|
ifneq ($(IS_TERMINAL),)
|
2019-08-30 13:55:32 +02:00
|
|
|
_ANSI_ESC := $(shell printf "\033")
|
|
|
|
COLOR_GREEN := $(_ANSI_ESC)[1;32m
|
|
|
|
COLOR_RED := $(_ANSI_ESC)[1;31m
|
|
|
|
COLOR_YELLOW := $(_ANSI_ESC)[1;33m
|
|
|
|
COLOR_PURPLE := $(_ANSI_ESC)[1;35m
|
|
|
|
COLOR_RESET := $(_ANSI_ESC)[0m
|
2020-01-10 08:40:00 +01:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
COLOR_ECHO := echo -e
|
|
|
|
SHELL=bash
|
|
|
|
else
|
2019-12-27 01:09:53 +01:00
|
|
|
COLOR_ECHO := /usr/bin/env echo -e
|
2020-01-10 08:40:00 +01:00
|
|
|
endif
|
2017-09-09 00:06:29 +02:00
|
|
|
endif
|
|
|
|
endif
|