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:
parent
8f19b1f94a
commit
a6eecca9cf
|
@ -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,31 +1004,26 @@ 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
|
||||||
|
`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/\.C$/.c/;
|
||||||
}
|
|
||||||
if ($new_name =~ /\.cpp$/i) {
|
|
||||||
$new_name =~ s/\.cpp$/.cpp/i;
|
$new_name =~ s/\.cpp$/.cpp/i;
|
||||||
}
|
$warn=1 if ($new_name =~ s/\.cxx$/.cpp/i);
|
||||||
if ($new_name =~ s/\.cxx$/.cpp/i) {
|
|
||||||
$warn=1;
|
|
||||||
}
|
|
||||||
if ($new_name =~ /\.rc$/i) {
|
|
||||||
$new_name =~ s/\.rc$/.rc/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
|
||||||
|
@ -1037,6 +1033,9 @@ sub fix_file_and_directory_names($)
|
||||||
$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) {
|
||||||
|
|
Loading…
Reference in New Issue