From 370eefcb78c25a02173496fe9abfc6be18401a96 Mon Sep 17 00:00:00 2001 From: "John S. Peterson" Date: Wed, 17 Jul 2013 05:50:19 +0200 Subject: [PATCH] Detecting `gcc` output without its command from a line that only contain a code file name because * some make files don't print the `gcc` command --- colormake.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/colormake.pl b/colormake.pl index 72b20f2..2608e7a 100755 --- a/colormake.pl +++ b/colormake.pl @@ -67,6 +67,9 @@ $cols = shift @ARGV || 0; $cols -= 19; +$file = '[^\/?*:;{}\\\]+'; +$code_file = "$file\.(c|cpp|cc|hpp)"; + $in = 'unknown'; $| = 1; while (<>) @@ -88,7 +91,13 @@ { $in = 'make'; } - elsif ($thisline =~ s/^(\s*(libtool:\s*)?((compile|link):\s*)?(([[:ascii:]]+-)?g?(cc|\+\+)|(g|c)\+\+).*)$/$col_gcc$1$col_norm/) + elsif ($thisline =~ s/^( + \s*(libtool:\s*)? + ((compile|link):\s*)? + (([[:ascii:]]+-)?g?(cc|\+\+)|(g|c)\+\+).* + |$code_file + )$ + /$col_gcc$1$col_norm/x) { $in = 'gcc'; }