X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=bin%2Fblhc;h=91a5f4943c29076d61bde0904dffc7aa8d38a74a;hp=5adfca6c13ea2d28d7e3c43c3a61d43c8530e443;hb=53e64de60f08fcb752b1f3ccb41c9e8555be8866;hpb=8d44f591b7523f7c13d5b32f1d9b130697a4e301 diff --git a/bin/blhc b/bin/blhc index 5adfca6..91a5f49 100755 --- a/bin/blhc +++ b/bin/blhc @@ -731,6 +731,7 @@ FILE: foreach my $file (@ARGV) { # Skip unnecessary tests when only preprocessing. my $flag_preprocess = 0; + my $dependency = 0; my $preprocess = 0; my $compile = 0; my $link = 0; @@ -740,11 +741,25 @@ FILE: foreach my $file (@ARGV) { $preprocess = 1; $flag_preprocess = 1 if $1 eq '-E'; $compile = 1 if $1 eq '-S' or $1 eq '-c'; + # Dependency generation for Makefiles. The other flags (-MF -MG -MP + # -MT -MQ) are always used with -M/-MM. + } elsif ($line =~ /\s(?:-M|-MM)\b/) { + $dependency = 1; # Otherwise assume we are linking. } else { $link = 1; } + # -MD/-MMD also cause dependency generation, but they don't imply -E! + if ($line =~ /\s(?:-MD|-MMD)\b/) { + $dependency = 0; + $flag_preprocess = 0; + } + + # Dependency generation for Makefiles, no preprocessing or other flags + # needed. + next if $dependency; + # Get all file extensions on this line. my @extensions = $line =~ /$file_extension_regex/go; # Ignore all unknown extensions to speedup the search below.