gcc (or other compilers) often generate huge text output and it's very difficult to see where the error is or miss warnings. I've done some search but havn't found a clean simple solution to color code the compiler output (so for instance warnings are yellow, errors are red, etc...)
Gcc 4.9 seems to have added this feature via the -fdiagnostics-color
flag:
here's an alternative if you are looking for something very simple:
#!/bin/bash -e make ${@} 2>&1 | perl -wln -M'Term::ANSIColor' -e ' m/Building|gcc|g++|\bCC\b|\bcc\b/ and print "\e[1;32m", "$_", "\e[0m" or m/Error/i and print "\e[1;91m", "$_", "\e[0m" or m/Warning/i and print "\e[1;93m", "$_", "\e[0m" or m/Linking|\.a\b/ and print "\e[1;36m", "$_", "\e[0m" or print; '
Just alias your make to this script and make sure it's executable...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With