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 15:02:16 +02:00
|
|
|
COLOR_GREEN := $(ANSI_GREEN)
|
|
|
|
COLOR_RED := $(ANSI_RED)
|
|
|
|
COLOR_YELLOW := $(ANSI_YELLOW)
|
|
|
|
COLOR_PURPLE := $(ANSI_PURPLE)
|
|
|
|
COLOR_RESET := $(ANSI_RESET)
|
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
|
2019-09-02 17:57:42 +02:00
|
|
|
|
|
|
|
# Colorizer functions:
|
|
|
|
# These functions wrap a block of text in $(COLOR_X)...$(COLOR_RESET).
|
|
|
|
# Do not nest calls to this functions or the colors will be wrong.
|
|
|
|
c_green = $(COLOR_GREEN)$(1)$(COLOR_RESET)
|
|
|
|
c_red = $(COLOR_RED)$(1)$(COLOR_RESET)
|
|
|
|
c_yellow = $(COLOR_YELLOW)$(1)$(COLOR_RESET)
|
|
|
|
c_purple = $(COLOR_PURPLE)$(1)$(COLOR_RESET)
|