mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
0d6a8879bc
The current code for detecting whether colors should be used by default was not working. Normally what programs such as git or grep do is check if they are writing to a pipe. To see the issue by yourself: $ BOARD=samr21-xpro make -C tests/periph_qdec > I_SHOULD_NOT_HAVE_COLORS 2>&1 This commit uses MAKE_TERMOUT, MAKE_TERMERR and if ANY of them is NOT a terminal, colors are disabled.
32 lines
639 B
Makefile
32 lines
639 B
Makefile
# Set colored output control sequences if the terminal supports it and if
|
|
# not disabled by the user
|
|
|
|
COLOR_GREEN :=
|
|
COLOR_RED :=
|
|
COLOR_PURPLE :=
|
|
COLOR_RESET :=
|
|
COLOR_ECHO := /bin/echo
|
|
|
|
ifeq ($(CC_NOCOLOR),)
|
|
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
|
|
endif
|
|
endif
|