Knowledge Base
Search
New article
Authentication is disabled (development mode).
Edit article
Title
Tags
Content
<pre><code class="language-makefile">DEBUG = 1 # print $1 with $2 being the desired colour. # Note, that $2 must be quoted as: # $(call debug,message,"\033[31m") # to print "message" in red debug = $(if $(DEBUG), $(warning $(shell echo -e "$(if $(2),$(2),\033[33m)$(1)\033[m"))) # print and execute $1, colour handling as above trace = $(if $(DEBUG), $(warning $(shell echo -e "$(if $(2),$(2),\033[33m)$(1)\033[m"))) $(1) .PHONY: all all: $(call debug,message,"\033[31m") $(call trace,install -d /tmp -m 755,"\033[36m")</code></pre>
Save
Cancel