File: colors.mk

package info (click to toggle)
zathura 0.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,396 kB
  • ctags: 1,365
  • sloc: ansic: 12,344; makefile: 443; xml: 79; python: 50; perl: 25
file content (31 lines) | stat: -rw-r--r-- 840 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# See LICENSE file for license and copyright information

ifeq ($(COLOR),1)
# GCC diagnostics colors
DIAGNOSTICS_COLOR_AVAILABLE ?= $(shell ($(CC) -fdiagnostics-color=always -E - </dev/null >/dev/null 2>/dev/null && echo 1) || echo 0)
ifeq ($(DIAGNOSTICS_COLOR_AVAILABLE),1)
CPPFLAGS     += -fdiagnostics-color=always
endif

# colorful output
TPUT ?= /usr/bin/tput
TPUT_AVAILABLE ?= $(shell ${TPUT} -V 2>/dev/null)

ifdef TPUT_AVAILABLE
COLOR_NORMAL  = `$(TPUT) sgr0`
COLOR_ACTION  = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4`
define colorecho
	@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef
else
define colorecho
	@echo " [$1]" $2
endef
endif
else
define colorecho
	@echo " [$1]" $2
endef
endif