diff --git a/dlls/make_dlls b/dlls/make_dlls index 9bd371096c550b2a3b6aae72cc05e1d80051dd2b..339e28ce904922f5384d32ab537970a3e9535274 100755 --- a/dlls/make_dlls +++ b/dlls/make_dlls @@ -1,7 +1,6 @@ #!/usr/bin/perl -w # # Update the dll dependencies in the dlls main Makefile.in. -# Must be run in the dlls/ directory of the Wine tree. # # Copyright 2001 Alexandre Julliard # @@ -22,9 +21,8 @@ use strict; -my $makefiles = `find . -name Makefile.in -print`; - my %directories = (); +my %testdirs = (); my %importlibs = (); my %static_implibs = (); my %staticlib_dirs = (); @@ -46,15 +44,39 @@ sub needs_symlink($) return $mod ne $directories{$_[0]}; } -foreach my $i (split(/\s/,$makefiles)) +sub update_file($) { - my $module; + my $file = shift; + if (!system "cmp $file $file.new >/dev/null") + { + unlink "$file.new"; + print "$file is unchanged\n"; + } + else + { + rename "$file.new", "$file"; + print "$file updated\n"; + } +} - next if $i =~ /\/tests\/Makefile.in/; +# if we are inside the dlls dir, go up one level +if (! -f "configure.ac" && -f "../configure.ac") { chdir(".."); } + +my $makefiles = `find dlls -name Makefile.in -print`; + +foreach my $i (split(/\s/,$makefiles)) +{ + if ($i =~ /dlls\/(.*)\/tests\/Makefile.in/) + { + $testdirs{$1} = "$1/tests"; + next; + } open MAKE,$i; - $module = undef; + my $module = undef; + my $dir = $i; + while (<MAKE>) { chop; @@ -67,12 +89,12 @@ foreach my $i (split(/\s/,$makefiles)) $module = $1; if ($module =~ /^lib.*\.a$/) { - ($staticlib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/; + ($staticlib_dirs{$module} = $i) =~ s/^dlls\/(.*)\/[^\/]+$/$1/; die "invalid module $module in dir $staticlib_dirs{$module}\n" if "lib$staticlib_dirs{$module}.a" ne $module; } else { - ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/; + ($directories{$module} = $i) =~ s/^dlls\/(.*)\/[^\/]+$/$1/; } next; } @@ -99,7 +121,7 @@ foreach my $i (split(/\s/,$makefiles)) close MAKE; } -open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new"; +open NEWMAKE,">dlls/Makefile.in.new" or die "cannot create dlls/Makefile.in.new"; ################################################################ # makefile header @@ -349,13 +371,12 @@ checklink:: \$(BUILDSUBDIRS:%=%/__checklink__) EOF close NEWMAKE; -rename "Makefile.in.new", "Makefile.in"; -printf "Successfully updated Makefile.in\n"; +update_file("dlls/Makefile.in"); ################################################################ # .gitignore file -open GITIGNORE, ">.gitignore.new" or die "cannot create .gitignore.new"; +open GITIGNORE, ">dlls/.gitignore.new" or die "cannot create dlls/.gitignore.new"; print GITIGNORE "# Automatically generated by make_dlls; DO NOT EDIT!!\n"; my @ignores = @@ -387,5 +408,32 @@ foreach my $mod (sort keys %importlibs) print GITIGNORE join("\n", sort @ignores) . "\n"; close GITIGNORE; -rename ".gitignore.new", ".gitignore"; -printf "Successfully updated .gitignore\n"; +update_file("dlls/.gitignore"); + +################################################################ +# configure.ac file + +open OLD_CONFIG, "configure.ac" or die "cannot open configure.ac"; +open NEW_CONFIG, ">configure.ac.new" or die "cannot create configure.ac.new"; + +while (<OLD_CONFIG>) +{ + print NEW_CONFIG $_; + last if /^dlls\/Makefile/; +} + +foreach my $dir (sort (values %directories, values %staticlib_dirs, values %testdirs)) +{ + print NEW_CONFIG "dlls/$dir/Makefile\n"; +} + +my $skip=1; +while (<OLD_CONFIG>) +{ + $skip = 0 unless /^dlls\//; + print NEW_CONFIG $_ unless $skip; +} + +close OLD_CONFIG; +close NEW_CONFIG; +update_file("configure.ac");