@@ -118,6 +118,51 @@ SPACE:=$(eval) $(eval)
118118export LC_ALL =C
119119export LANG =C
120120
121+ # Respect `FORCE_COLOR` environment variable: <https://force-color.org/>.
122+ ifndef FORCE_COLOR
123+ FORCE_COLOR := ""
124+ endif
125+
126+ # Respect `NO_COLOR` environment variable: <https://no-color.org/>.
127+ ifndef NO_COLOR
128+ NO_COLOR := ""
129+ endif
130+
131+ # When both `FORCE_COLOR` and `NO_COLOR` are defined, the former has precedence.
132+ ifneq ($(FORCE_COLOR ) , "")
133+ NO_COLOR = ""
134+ endif
135+
136+ WARNCOLOR: ="\033[33;1m"
137+ ENDCOLOR: ="\033[0m"
138+
139+ CCCOLOR: ="\033[34m"
140+ LINKCOLOR: ="\033[34;1m"
141+ PERLCOLOR: ="\033[35m"
142+ FLISPCOLOR: ="\033[32m"
143+ JULIACOLOR: ="\033[32;1m"
144+ DTRACECOLOR: ="\033[32;1m"
145+
146+ SRCCOLOR: ="\033[33m"
147+ BINCOLOR: ="\033[37;1m"
148+ JULCOLOR: ="\033[34;1m"
149+
150+ ifneq ($(NO_COLOR ) , "")
151+ WARNCOLOR: =""
152+ ENDCOLOR: =""
153+
154+ CCCOLOR: =""
155+ LINKCOLOR: =""
156+ PERLCOLOR: =""
157+ FLISPCOLOR: =""
158+ JULIACOLOR: =""
159+ DTRACECOLOR: =""
160+
161+ SRCCOLOR: =""
162+ BINCOLOR: =""
163+ JULCOLOR: =""
164+ endif
165+
121166# We need python for things like BB triplet recognition and relative path computation.
122167# We don't really care about version, generally, so just find something that works:
123168PYTHON := "$(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo "{python|python3|python2} not found") "
@@ -140,7 +185,7 @@ ifeq ($(BUILDROOT),)
140185ifeq ("$(origin O ) ", "command line")
141186 BUILDROOT := $(abspath $O)
142187 BUILDDIR := $(abspath $(BUILDROOT ) /$(call rel_path,$(JULIAHOME ) ,$(SRCDIR ) ) )
143- $(info $(shell printf '\033[32;1mBuilding into $(BUILDROOT)\033[0m ')) # use printf to expand the escape sequences
188+ $(info $(shell printf '$(JULIACOLOR)Building into $(BUILDROOT)$(ENDCOLOR) ')) # use printf to expand the escape sequences
144189else
145190 BUILDROOT: =$(JULIAHOME )
146191endif
@@ -1759,24 +1804,10 @@ ifndef VERBOSE
17591804VERBOSE := 0
17601805endif
17611806
1762- WARNCOLOR: ="\033[33;1m"
1763- ENDCOLOR: ="\033[0m"
1764-
17651807ifeq ($(VERBOSE ) , 0)
17661808
17671809QUIET_MAKE = -s
17681810
1769- CCCOLOR: ="\033[34m"
1770- LINKCOLOR: ="\033[34;1m"
1771- PERLCOLOR: ="\033[35m"
1772- FLISPCOLOR: ="\033[32m"
1773- JULIACOLOR: ="\033[32;1m"
1774- DTRACECOLOR: ="\033[32;1m"
1775-
1776- SRCCOLOR: ="\033[33m"
1777- BINCOLOR: ="\033[37;1m"
1778- JULCOLOR: ="\033[34;1m"
1779-
17801811GOAL =$(subst ','\'',$(subst $(abspath $(JULIAHOME ) ) /,,$(abspath $@ ) ) )
17811812
17821813PRINT_CC = printf ' %b %b\n' $(CCCOLOR ) CC$(ENDCOLOR ) $(SRCCOLOR )$(GOAL )$(ENDCOLOR ) ; $(1 )
@@ -1797,7 +1828,7 @@ PRINT_FLISP = echo '$(subst ','\'',$(1))'; $(1)
17971828PRINT_JULIA = echo '$(subst ','\'',$(1 ) ) '; $(1 )
17981829PRINT_DTRACE = echo '$(subst ','\'',$(1 ) ) '; $(1 )
17991830
1800- endif
1831+ endif # VERBOSE
18011832
18021833# Makefile debugging trick:
18031834# call print-VARIABLE to see the runtime value of any variable
0 commit comments