1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/makefiles/color.inc.mk
Benjamin Valentin b18b8e4f77 makefiles/color: fix build on NixOS
On NixOS, there is no `/bin/echo`, instead
`which echo` will return

    /home/benpicco/.nix-profile/bin/echo

so hard-coding the path will break here.

Use `/usr/bin/env` to get the path of `echo`.
This should be availiable on all systems at the same location.
2020-02-27 18:13:36 +01:00

29 lines
730 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 := /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 := \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 := /usr/bin/env echo -e
endif
endif
endif