Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I highlight the warning and error lines in the make output?

Sometimes, make's output fills the screen. It's a little bit hard to identify all the warning and error message lines. I know may shell color output can help Can anyone can help me?

like image 268
Eric guan Avatar asked Jun 22 '11 07:06

Eric guan


2 Answers

Have a look at colormake, found here

$ apt-cache search colormake colormake - simple wrapper around make to colorize output 

Using the power of google, I also found this bash-function.

make() {   pathpat="(/[^/]*)+:[0-9]+"   ccred=$(echo -e "\033[0;31m")   ccyellow=$(echo -e "\033[0;33m")   ccend=$(echo -e "\033[0m")   /usr/bin/make "$@" 2>&1 | sed -E -e "/[Ee]rror[: ]/ s%$pathpat%$ccred&$ccend%g" -e "/[Ww]arning[: ]/ s%$pathpat%$ccyellow&$ccend%g"   return ${PIPESTATUS[0]} } 
like image 71
Fredrik Pihl Avatar answered Oct 07 '22 05:10

Fredrik Pihl


I have came to this questions searching for a solution to colorize make output and then remembered a while back I have researched a good generic log colorizer and found ccze. It works with anything I throw at it from Minecraft server logs to Exim MTA.

make | ccze -A

NOTE: specifying -A option enables 'raw-ansi' otherwise some output is 'cleared' at end of run in my experience. enter image description here

like image 38
Daniel Sokolowski Avatar answered Oct 07 '22 06:10

Daniel Sokolowski