summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-02-05 03:40:35 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-02-05 03:40:35 +0200
commitad76d4d44db3a97a4b0083d18e116d4af98b8f29 (patch)
tree1e9b02a24098b983cae4be0ae4504e456ee4a996 /Makefile
parent548c9f4ac34a64695e386e20213f6c9a3b583f9f (diff)
Check for $TERM in Makefile
If $TERM is not set, for example in a build environment, tput prints out warnings. Disable ANSI formatting completely when $TERM is unset or zero
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 5 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b3b721b3..3446bff7 100644
--- a/Makefile
+++ b/Makefile
@@ -34,12 +34,12 @@ MANPATHS := `manpath 2> /dev/null`
VERSION ?= `sed -n "s/^version\s*=\s*\"\(.*\)\"/\1/p" Cargo.toml`
# Output parameters
-BOLD ?= `tput bold`
-UNDERLINE ?= `tput smul`
-ANSI_RESET ?= `tput sgr0`
+BOLD ?= `[ -z $${TERM} ] && echo "" || tput bold`
+UNDERLINE ?= `[ -z $${TERM} ] && echo "" || tput smul`
+ANSI_RESET ?= `[ -z $${TERM} ] && echo "" || tput sgr0`
CARGO_COLOR ?= `[ -z $${NO_COLOR+x} ] && echo "" || echo "--color=never "`
-RED ?= `[ -z $${NO_COLOR+x} ] && tput setaf 1 || echo ""`
-GREEN ?= `[ -z $${NO_COLOR+x} ] && tput setaf 2 || echo ""`
+RED ?= `[ -z $${NO_COLOR+x} ] && ([ -z $${TERM} ] && echo "" || tput setaf 1) || echo ""`
+GREEN ?= `[ -z $${NO_COLOR+x} ] && ([ -z $${TERM} ] && echo "" || tput setaf 2) || echo ""`
.POSIX:
.SUFFIXES: