# CONSTANTS/VARIABLES
# Regex to catch compiler commands.
-my $cc_regex = qr/(?:(?<!\.)cc|(?:x86_64-linux-gnu-)?gcc|g\+\+|c\+\+)/;
+my $cc_regex = qr/(?:x86_64-linux-gnu-)?(?:(?<!\.)cc|gcc|g\+\+|c\+\+)(?:-[\d.]+)?/;
# Regex to catch (GCC) compiler warnings.
my $warning_regex = qr/^(.+?):([0-9]+):[0-9]+: warning: (.+?) \[(.+?)\]$/;
my $linker = 0;
# Linker commands.
- if ($line =~ m{\s-o # -o
- [\s\\]*\s+ # possible line continuation
- (?:[A-Za-z0-9_/.-]+/)? # path to file
- [A-Za-z0-9_-]+ # binary name (no dots!)
+ if ($line =~ m{\s-o # -o
+ [\s\\]*\s+ # possible line continuation
+ (?:[/.A-Za-z0-9~_-]+/)? # path to file
+ [A-Za-z0-9~_-]+ # binary name (no dots!)
(?:[0-9.]*\.so[0-9.]*[a-z]? # library (including version)
|\.la)?
- (?:\s|\\|\$) # end of file name
+ (?:\s|\\|$) # end of file name
}x
or $line =~ /^libtool: link: /
or $line =~ m{\s*/bin/bash .+?libtool\s+(.+?\s+)?--mode=(re)?link}) {