Only 'fix' the names of source files and directories (this way

documentation files are unharmed).
Better handle Makefiles generated by Winemaker. In particular, don't
rename them to makefile.win!
This commit is contained in:
Francois Gouget 2005-02-21 18:29:44 +00:00 committed by Alexandre Julliard
parent 8f19b1f94a
commit a6eecca9cf
1 changed files with 22 additions and 23 deletions

View File

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