title: Color highlighting of Makefile warnings and errors
body: <p>I have written a Makefile which works fine; I am just posting the part of it under investigation:</p>
  
  <pre><code>BUILD_PRINT = @echo -e "\e[1;34mBuilding $&lt;\e[0m"
  COMPILE_cpp = $(CXX) $(CFLAGS) -o $@ -c $&lt; $(MAKEDEP) $(INCLUDES)
  %.o : %.cpp
      $(BUILD_PRINT)
      $(COMPILE_cpp)
  .SUFFIXES: .o .cpp
  </code></pre>
  
  <p>I would like to highlight the warnings and errors given by the compiler without using external tools (such as colorgcc or CMake); I thought that a good way to hack it was via "<em>bash script tricks</em>". Looking at the solution posted in <a href="https://stackoverflow.com/questions/6436563/how-can-i-highlight-the-warning-and-error-lines-int-the-make-output">How Can I highlight the warning and error lines in the make output?</a> I have tried the following:</p>
  
  <pre><code>pathpat="(/[^/]*)+:[0-9]+"
  ccred=$(echo -e "\033[0;31m")
  ccyellow=$(echo -e "\033[0;33m")
  ccend=$(echo -e "\033[0m")
  
  BUILD_PRINT = @echo -e "\e[1;34mBuilding $&lt;\e[0m"
  COMPILE_cpp = $(CXX) $(CFLAGS) -o $@ -c $&lt; $(MAKEDEP) $(INCLUDES)
  %.o : %.cpp
      $(BUILD_PRINT)
      $(COMPILE_cpp) 2&gt;&amp;1 | sed -e "/[Ee]rror[: ]/ s%$pathpat%$ccred&amp;$ccend%g" -e "/[Ww]arning[: ]/ s%$pathpat%$ccyellow&amp;$ccend%g" echo "${PIPESTATUS[0]}"
  .SUFFIXES: .o .cpp
  </code></pre>
  
  <p>but it is not working. I get the following output</p>
  
  <pre><code>Building main.cpp
  g++ -o main.o -c main.cpp  2&gt;&amp;1 | sed -e "/[Ee]rror[: ]/ s%athpat%cred&amp;cend%g" -e "/[Ww]arning[: ]/ s%athpat%cyellow&amp;cend%g" echo ""
  sed: can't read echo: No such file or directory
  sed: can't read : No such file or directory
  </code></pre>
  
  <p>Thanks in advance!</p>