diff --git a/tools/winemaker b/tools/winemaker index fa4adeb5236..1bd08bafe13 100755 --- a/tools/winemaker +++ b/tools/winemaker @@ -992,6 +992,7 @@ sub source_scan() # - they have the case desired by the user # - their extension is of the appropriate case # - they don't contain annoying characters like ' ', '$', '#', ... +# But only perform these changes for source files and directories. sub fix_file_and_directory_names($); sub fix_file_and_directory_names($) { @@ -1003,40 +1004,38 @@ sub fix_file_and_directory_names($) next; } # Set $warn to 1 if the user should be warned of the renaming - my $warn=0; - - # autoconf and make don't support these characters well + my $warn; my $new_name=$dentry; - $new_name =~ s/[ \$]/_/g; - # Only all lowercase extensions are supported (because of the - # transformations ':.c=.o') . - if (-f "$dirname/$new_name") { - if ($new_name =~ /\.C$/) { - $new_name =~ s/\.C$/.c/; - } - if ($new_name =~ /\.cpp$/i) { - $new_name =~ s/\.cpp$/.cpp/i; - } - if ($new_name =~ s/\.cxx$/.cpp/i) { - $warn=1; - } - if ($new_name =~ /\.rc$/i) { - $new_name =~ s/\.rc$/.rc/i; - } + if (-f "$dirname/$dentry") + { + # Don't rename Winemaker's makefiles + next if ($dentry eq "Makefile" and + `head -n 1 "$dirname/$dentry"` =~ /Generated by Winemaker/); + + # Leave non-source files alone + next if ($new_name !~ /(^makefile|\.(c|cpp|h|rc))$/i); + + # Only all lowercase extensions are supported (because of + # rules like '.c.o:'. + $new_name =~ s/\.C$/.c/; + $new_name =~ s/\.cpp$/.cpp/i; + $warn=1 if ($new_name =~ s/\.cxx$/.cpp/i); + $new_name =~ s/\.rc$/.rc/i; # And this last one is to avoid confusion then running make - if ($new_name =~ s/^makefile$/makefile.win/) { - $warn=1; - } + $warn=1 if ($new_name =~ s/^makefile$/makefile.win/i); } # Adjust the case to the user's preferences if (($opt_lower == $OPT_LOWER_ALL and $dentry =~ /[A-Z]/) or ($opt_lower == $OPT_LOWER_UPPERCASE and $dentry !~ /[a-z]/) ) { - $new_name=lc $new_name; + $new_name=lc $new_name; } + # autoconf and make don't support these characters well + $new_name =~ s/[ \$]/_/g; + # And finally, perform the renaming if ($new_name ne $dentry) { if ($warn) {