1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00
RIOT/makefiles/color.inc.mk
Juan Carrano 1036115f2d
makefiles/utils/ansi: Refactor ansi codes into their own file.
The escape codes and special chars now live in their own module. The
color module is only concerned with detecting whether to use colors or
not.

Additional variables are defined with hard a coded ESC char, a tab and a
newline. This removes the need for echo or printf.
2021-05-04 10:52:50 +02:00

30 lines
764 B
Makefile

# Set colored output control sequences if the terminal supports it and if
# not disabled by the user
COLOR_GREEN :=
COLOR_RED :=
COLOR_YELLOW :=
COLOR_PURPLE :=
COLOR_RESET :=
COLOR_ECHO := /usr/bin/env echo
# 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),)
# Check if terminal support colored output
ifneq ($(IS_TERMINAL),)
COLOR_GREEN := $(ANSI_GREEN)
COLOR_RED := $(ANSI_RED)
COLOR_YELLOW := $(ANSI_YELLOW)
COLOR_PURPLE := $(ANSI_PURPLE)
COLOR_RESET := $(ANSI_RESET)
ifeq ($(OS),Darwin)
COLOR_ECHO := echo -e
SHELL=bash
else
COLOR_ECHO := /usr/bin/env echo -e
endif
endif
endif