make_progs: Update the directory list in configure.ac too.

This commit is contained in:
Alexandre Julliard 2006-08-25 11:50:21 +02:00
parent 39f357f873
commit 9a2df7deeb

View file

@ -22,8 +22,6 @@
use strict;
my $makefiles = `find . -name Makefile.in -print`;
my %directories = ();
# Programs that we want to install in the bin directory too
@ -55,12 +53,30 @@ my %dont_install =
"winetest" => 1,
);
sub update_file($)
{
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";
}
}
# if we are inside the programs dir, go up one level
if (! -f "configure.ac" && -f "../configure.ac") { chdir(".."); }
my $makefiles = `find programs -name Makefile.in -print`;
foreach my $i (split(/\s/,$makefiles))
{
my $module;
next if $i =~ /\/tests\/Makefile.in/;
open MAKE,$i;
$module = undef;
@ -75,7 +91,7 @@ foreach my $i (split(/\s/,$makefiles))
{
$module = $1;
next if ($module eq "none");
($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
($directories{$module} = $i) =~ s/^programs\/(.*)\/[^\/]+$/$1/;
die "invalid module $module in dir $directories{$module}\n" if "$directories{$module}.exe" ne $module;
last;
}
@ -93,7 +109,7 @@ foreach my $i (split(/\s/,$makefiles))
close MAKE;
}
open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
open NEWMAKE,">programs/Makefile.in.new" or die "cannot create programs/Makefile.in.new";
################################################################
# makefile header
@ -140,6 +156,8 @@ foreach my $dir (sort keys %alldirs)
print NEWMAKE <<EOF;
INSTALLDIRS = \$(DESTDIR)\$(bindir)
\@MAKE_RULES\@
all: wineapploader winelauncher \$(SUBDIRS)
@ -154,8 +172,7 @@ winelauncher: winelauncher.in
.PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
install-apploader: wineapploader dummy
\$(MKINSTALLDIRS) \$(DESTDIR)\$(bindir)
install-apploader: wineapploader \$(INSTALLDIRS) dummy
\$(INSTALL_SCRIPT) wineapploader \$(DESTDIR)\$(bindir)/wineapploader
\$(INSTALLPROGS:%=%/__installprog__): install-apploader
@ -166,8 +183,7 @@ install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
install-progs: # nothing to do here
install:: winelauncher install-progs\$(DLLEXT)
\$(MKINSTALLDIRS) \$(DESTDIR)\$(bindir)
install:: winelauncher install-progs\$(DLLEXT) \$(INSTALLDIRS)
\$(INSTALL_SCRIPT) winelauncher \$(DESTDIR)\$(bindir)/winelauncher
uninstall::
@ -185,13 +201,12 @@ check test:: \$(SUBDIRS:%=%/__test__)
EOF
close NEWMAKE;
rename "Makefile.in.new", "Makefile.in";
printf "Successfully updated Makefile.in\n";
update_file("programs/Makefile.in");
################################################################
# .gitignore file
open GITIGNORE, ">.gitignore.new" or die "cannot create .gitignore.new";
open GITIGNORE, ">programs/.gitignore.new" or die "cannot create programs/.gitignore.new";
print GITIGNORE "# Automatically generated by make_dlls; DO NOT EDIT!!\n";
my @ignores =
@ -209,5 +224,32 @@ foreach my $dir (sort keys %alldirs)
print GITIGNORE join("\n", sort @ignores) . "\n";
close GITIGNORE;
rename ".gitignore.new", ".gitignore";
printf "Successfully updated .gitignore\n";
update_file("programs/.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 /^programs\/Makefile/;
}
foreach my $dir (sort values %directories)
{
print NEW_CONFIG "programs/$dir/Makefile\n";
}
my $skip=1;
while (<OLD_CONFIG>)
{
$skip = 0 unless /^programs\//;
print NEW_CONFIG $_ unless $skip;
}
close OLD_CONFIG;
close NEW_CONFIG;
update_file("configure.ac");