make.pl 2.65 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#! /usr/bin/perl

# Attributes
$bold = "\033[1m";

# Colors
$white  = "\033[37m";
$yellow  = "\033[33m";
$magenta  = "\033[35m";
$blue  = "\033[34m";
$red  = "\033[31m";
$reset = "\033[0m";

# Combinations
$info   = $white.$bold;
$warn   = $yellow.$bold;
$error  = $red.$bold;
$file   = $magenta.$bold;
$lineno = $blue.$bold;

while(<STDIN>)
{
     $line = $_;
     chomp $line;
     # Skip entering/leaving directories and incomplete lines
26
     if($line =~ /make\[([0-9]*)\]:.*/ ||
27 28
#       $line =~ /.*\s\\$/ ||
        $line =~ /^test\s\-z\s/ ||
29
        $line =~ /^Making\sclean\sin\s\./ ||
Clément Stenac's avatar
Clément Stenac committed
30
	$line =~ /then\smv\s-f/ ||
31
	$line =~ /.*make\s\s.*/ ||
32
        $line =~ /make\s\sall-recursive/ ||
Clément Stenac's avatar
Clément Stenac committed
33 34
        $line =~ /[A-z0-9-]*ar\s[A-z0-9]*\s([A-z0-9\-_\/\.]*)\s.*/ ||
        $line =~ /^[A-z0-9-]*ranlib\s[A-z0-9-_]*plugin(.*)/ ||
Clément Stenac's avatar
Clément Stenac committed
35 36
        $line =~ /^touch.*/ ||
        $line =~ /^srcdir=.*/ ||
37
        $line =~ /^.* (lib[A-z0-9-_]*plugin.so).*/ ||
38 39 40
	$line =~ /^\s*gcc(-.*)?\s-std=.*/ ||
        $line =~ /^\sgcc(-.*)?\s-mmacosx.*/ ||
        $line =~ /^\sg\+\+(-.*)?\s.*/ ||
Rafaël Carré's avatar
Rafaël Carré committed
41
#    $line =~ /^.*moc.*/ ||
42 43 44
	$line =~ /^.*libtool.*\-o\s(lib.*\.la).*/ ||
        $line =~ /^.*rm\s\-f\s(.*)/ ||
	$line =~ /^rm\s-fr\s(.*)/ ||
45 46
	$line =~ /^mv\s-f\s(.*)/ ||
	$line =~ /^ln\s-s\s(.*)/ ||
47
	$line =~ /^\s*echo\s/ ||
48
	$line =~ /^mkdir\s/ ||
49
	$line =~ /^\s*cat\s/ ||
50 51 52 53
	$line =~ /^grep\s/ ||
	$line =~ /^cd\s/ ||
	$line =~ /^sed\s/ ||
	$line =~ /^bindir=\s/ ||
54
	$line =~ /^libtool:\s/ ||
55
	$line =~ /^\/bin\/sh/ ||
56
	$line =~ /^\/usr\/bin\/moc-qt4/ ||
57
	$line =~ /^\/usr\/bin\/uic-qt4/ ||
58
	$line =~ /^creating lib.*/)
59
     {}
60 61
     # Info
     elsif(
62
	  $line =~ s/^.*\-shared.*(lib.*\.so).*/ LINK    : $1/g ||
63
          $line =~ s/^.* (lib.*\.so).*/ LINK    : $1/g ||
Clément Stenac's avatar
Clément Stenac committed
64
          $line =~ s/^.* (lib.*\.o)\s\.\/(.*)/ COMPILE : $2/g ||
Rafaël Carré's avatar
Rafaël Carré committed
65
          $line =~ s/^.*(lib.*\.lo)\s.*/ COMPILE : $1/g ||
Clément Stenac's avatar
Clément Stenac committed
66
          $line =~ s/^.* (lib.*\.o)\s`.*`(.*);\ \\/ COMPILE : $2/ ||
67
          $line =~ s/.*\-o\s([^\s]*)\s`.*`([^\s]*);.*/ COMPILE : $2/g ||
68
          $line =~ s/^[A-z0-9-]*ranlib\s(.*)/ RANLIB  : $1/g ||
69
          $line =~ s/^Making\sall\sin\s(.*)/MAKE     : $1/g ||
70
          $line =~ s/^Making\sclean\sin\s(.*)/CLEAN  : $1/g  )
71 72 73 74 75 76 77 78
     {
	print $info.$line.$reset."\n";
     }
     # Warning
     elsif (
	  $line =~ s/(.*):([0-9]*):\swarning\:(.*)/WARNING : $file$1: $lineno$2: $warn$3/g  ||
          $line =~ s/.*is\sdeprecated.*/WARNING : $line/g )
     {
79
	print STDERR $warn.$line.$reset."\n";
80 81 82 83 84
     }
     # Error
     elsif (
	  $line =~ s/(.*):([0-9]*):\serror\:(.*)/ERROR   : $file$1: $lineno$2: $error$3/g  )
     {
85
	print STDERR $error.$line.$reset."\n";
86
     }
87
     # Print unmatched lines
88 89 90 91 92
     else
     {
 	print $line."\n";
     }
}