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
# - 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,31 +1004,26 @@ 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$/) {
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/;
}
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) {
$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
@ -1037,6 +1033,9 @@ sub fix_file_and_directory_names($)
$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) {