#!/usr/bin/perl -w # cmake .1 Adrian Likins # Copyright (C) 1999 Adrian Likins # # I've only tested this with gcc and gnu make, it probabaly wont work # on other compilers output. # # It requires the ANSIColor perl module from: # http://www.cpan.org/modules/by-module/Term/ # # For now, to use: # # cmake -whatever-make-options-you-use here # # All the options get passed to make # # This is release under the General Public License # # If you like this, you'll probabaly find color_cvs # interesting too, both available from: # http://adrian.gimp.org/bored.html # use strict; use Term::ANSIColor; use IPC::Open3; use FileHandle; my %files_with_warnings; my %line_and_warning; my $what; my $filename; my $line_number; my $wfh; #open3(\*wfh, \*MAKE, \*MAKE, "make") || die "aieeee!\n"; open(MAKE, "make 2>&1 |") or die "aieee\n"; while() { # just makes the ugly make lines automake creates prettier ;-> chomp; if(/^gcc/){ s/\s+| [^\n] / /mg; } if(/.*c:[0-9]+:\swarning/){ s/(.*c):([0-9]+):\swarning:\s(.*)//; print color("red"), "$1",,color("reset"), " :", color("blue"), " $2", color("green"), " $3", color("reset"); $line_and_warning{$2} = $3; for $what (keys %line_and_warning){ $files_with_warnings{$1}{$what} = $line_and_warning{$what}; } } print; print "\n"; } foreach $filename ( keys %files_with_warnings) { print "$filename: \n"; foreach $line_number (keys %{ $files_with_warnings{$filename} } ){ print " $line_number $files_with_warnings{$filename}{$line_number}\n "; } print "\n"; }