From 82025e2845f71ee9266105e495939f1ca796520f Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Fri, 10 May 2013 07:10:24 +0000 Subject: [PATCH] Add correct dependency generation options Add command line arguments to preprocessor to correctly output dependency rules when using -MD or -MMD. This avoids creating a -.d file when building FFMpeg. --- gas-preprocessor.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl index 57ad637..2f537a7 100755 --- a/gas-preprocessor.pl +++ b/gas-preprocessor.pl @@ -48,6 +48,22 @@ @gcc_cmd = map { /\.[csS]$/ ? qw(-x assembler -) : $_ } @gcc_cmd; @preprocess_c_cmd = map { /\.o$/ ? "-" : $_ } @preprocess_c_cmd; +# if creating dependency file as side effect, avoid creating an output file named '-.d' +if ((grep /^-MM?D/, @preprocess_c_cmd) && !(grep /^-MF$/, @preprocess_c_cmd)) { + foreach my $i (@preprocess_c_cmd) { + if ($i =~ /\.[csS]$/) { + my $outputfile = $i; + $outputfile =~ s/\.[csS]$/.o/; + push(@preprocess_c_cmd, "-MT"); + push(@preprocess_c_cmd, $outputfile); + $outputfile =~ s/\.o$/.d/; + push(@preprocess_c_cmd, "-MF"); + push(@preprocess_c_cmd, $outputfile); + last; + } + } +} + my $comm; # detect architecture from gcc binary name