2003-11-30 07:18:43 +01:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
#
|
|
|
|
# Update the dependencies in the programs main Makefile.in.
|
|
|
|
# Must be run in the programs/ directory of the Wine tree.
|
|
|
|
#
|
|
|
|
# Copyright 2003 Alexandre Julliard
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-11-30 07:18:43 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my %directories = ();
|
|
|
|
|
|
|
|
# Programs that we want to install in the bin directory too
|
|
|
|
my %bin_install =
|
|
|
|
(
|
2005-05-10 18:02:04 +02:00
|
|
|
"msiexec" => 1,
|
2003-11-30 07:18:43 +01:00
|
|
|
"notepad" => 1,
|
|
|
|
"progman" => 1,
|
|
|
|
"regedit" => 1,
|
|
|
|
"regsvr32" => 1,
|
|
|
|
"uninstaller" => 1,
|
|
|
|
"wcmd" => 1,
|
|
|
|
"wineboot" => 1,
|
2004-01-06 21:49:58 +01:00
|
|
|
"winebrowser" => 1,
|
2003-11-30 07:18:43 +01:00
|
|
|
"winecfg" => 1,
|
|
|
|
"wineconsole" => 1,
|
|
|
|
"winedbg" => 1,
|
|
|
|
"winefile" => 1,
|
|
|
|
"winemine" => 1,
|
|
|
|
"winepath" => 1,
|
|
|
|
"winhelp" => 1,
|
|
|
|
);
|
|
|
|
|
|
|
|
# Programs that we don't want to install at all
|
|
|
|
my %dont_install =
|
|
|
|
(
|
|
|
|
"cmdlgtst" => 1,
|
|
|
|
"view" => 1,
|
2006-02-09 17:45:35 +01:00
|
|
|
"winetest" => 1,
|
2003-11-30 07:18:43 +01:00
|
|
|
);
|
|
|
|
|
2006-08-25 11:50:21 +02:00
|
|
|
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(".."); }
|
|
|
|
|
2006-08-28 11:57:10 +02:00
|
|
|
my @args = @ARGV;
|
|
|
|
if (!@args) { @args = split /\s/, `find programs -name Makefile.in -print`; }
|
2006-08-25 11:50:21 +02:00
|
|
|
|
2006-08-28 11:57:10 +02:00
|
|
|
foreach my $i (@args)
|
2003-11-30 07:18:43 +01:00
|
|
|
{
|
|
|
|
my $module;
|
|
|
|
|
|
|
|
open MAKE,$i;
|
|
|
|
|
|
|
|
$module = undef;
|
|
|
|
while (<MAKE>)
|
|
|
|
{
|
|
|
|
chop;
|
|
|
|
# hack to disable this program... the MKPROG_SKIP comment must appear
|
|
|
|
# at the very top of the Makefile.in
|
|
|
|
last if (/^\#\s*MKPROG_SKIP/);
|
|
|
|
|
|
|
|
if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
|
|
|
|
{
|
|
|
|
$module = $1;
|
|
|
|
next if ($module eq "none");
|
2006-08-25 11:50:21 +02:00
|
|
|
($directories{$module} = $i) =~ s/^programs\/(.*)\/[^\/]+$/$1/;
|
2006-03-20 20:47:58 +01:00
|
|
|
die "invalid module $module in dir $directories{$module}\n" if "$directories{$module}.exe" ne $module;
|
2003-11-30 07:18:43 +01:00
|
|
|
last;
|
|
|
|
}
|
|
|
|
if (/^PROGRAMS\s*=((\s*[a-zA-Z0-9_.]+)+)/)
|
|
|
|
{
|
|
|
|
my @programs = split / /, $1;
|
|
|
|
foreach my $prog (@programs)
|
|
|
|
{
|
|
|
|
next unless $prog =~ /\.exe$/;
|
|
|
|
($directories{$prog} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
|
|
|
|
}
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close MAKE;
|
|
|
|
}
|
|
|
|
|
2006-08-25 11:50:21 +02:00
|
|
|
open NEWMAKE,">programs/Makefile.in.new" or die "cannot create programs/Makefile.in.new";
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
################################################################
|
|
|
|
# makefile header
|
|
|
|
|
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
# Automatically generated by make_progs; DO NOT EDIT!!
|
|
|
|
|
|
|
|
TOPSRCDIR = \@top_srcdir\@
|
|
|
|
TOPOBJDIR = ..
|
|
|
|
SRCDIR = \@srcdir\@
|
|
|
|
VPATH = \@srcdir\@
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
# output the subdirs list
|
|
|
|
|
|
|
|
# get rid of duplicates
|
|
|
|
my %alldirs = ();
|
|
|
|
foreach my $dir (sort values %directories) { $alldirs{$dir} = 1; }
|
|
|
|
|
|
|
|
print NEWMAKE "SUBDIRS =";
|
|
|
|
foreach my $dir (sort keys %alldirs)
|
|
|
|
{
|
|
|
|
printf NEWMAKE " \\\n\t%s", $dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
print NEWMAKE "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS =";
|
|
|
|
foreach my $dir (sort keys %alldirs)
|
|
|
|
{
|
|
|
|
next if $dont_install{$dir};
|
|
|
|
printf NEWMAKE " \\\n\t%s", $dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
print NEWMAKE "\n\n# Programs to install in bin directory\nINSTALLPROGS =";
|
|
|
|
foreach my $dir (sort keys %alldirs)
|
|
|
|
{
|
|
|
|
printf NEWMAKE " \\\n\t%s", $dir if $bin_install{$dir};
|
|
|
|
}
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
# output the build and install targets
|
|
|
|
|
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
|
|
|
|
|
2006-08-25 11:50:21 +02:00
|
|
|
INSTALLDIRS = \$(DESTDIR)\$(bindir)
|
|
|
|
|
2003-11-30 07:18:43 +01:00
|
|
|
\@MAKE_RULES\@
|
|
|
|
|
2006-03-20 20:47:58 +01:00
|
|
|
all: wineapploader winelauncher \$(SUBDIRS)
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
wineapploader: wineapploader.in
|
|
|
|
sed -e 's,\@bindir\\\@,\$(bindir),g' \$(SRCDIR)/wineapploader.in >\$\@ || (\$(RM) \$\@ && false)
|
|
|
|
|
|
|
|
winelauncher: winelauncher.in
|
|
|
|
sed -e 's,\@bindir\\\@,\$(bindir),g' -e 's,\@libdir\\\@,\$(libdir),g' -e 's,\@dlldir\\\@,\$(dlldir),g' \$(SRCDIR)/winelauncher.in >\$\@ || (\$(RM) \$\@ && false)
|
|
|
|
|
|
|
|
# Rules for installation
|
|
|
|
|
|
|
|
.PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
|
|
|
|
|
2006-08-25 11:50:21 +02:00
|
|
|
install-apploader: wineapploader \$(INSTALLDIRS) dummy
|
2006-02-14 13:51:38 +01:00
|
|
|
\$(INSTALL_SCRIPT) wineapploader \$(DESTDIR)\$(bindir)/wineapploader
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
\$(INSTALLPROGS:%=%/__installprog__): install-apploader
|
2006-02-14 13:51:38 +01:00
|
|
|
\$(RM) \$(DESTDIR)\$(bindir)/`dirname \$\@` && \$(LN) \$(DESTDIR)\$(bindir)/wineapploader \$(DESTDIR)\$(bindir)/`dirname \$\@`
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
|
2006-02-14 13:51:38 +01:00
|
|
|
\$(RM) \$(DESTDIR)\$(bindir)/wineapploader
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
install-progs: # nothing to do here
|
|
|
|
|
2006-08-25 11:50:21 +02:00
|
|
|
install:: winelauncher install-progs\$(DLLEXT) \$(INSTALLDIRS)
|
2006-02-14 13:51:38 +01:00
|
|
|
\$(INSTALL_SCRIPT) winelauncher \$(DESTDIR)\$(bindir)/winelauncher
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
uninstall::
|
2006-02-14 13:51:38 +01:00
|
|
|
-cd \$(DESTDIR)\$(bindir) && \$(RM) wineapploader winelauncher \$(INSTALLPROGS)
|
|
|
|
-rmdir \$(DESTDIR)\$(dlldir)
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
clean::
|
2006-03-20 20:47:58 +01:00
|
|
|
\$(RM) wineapploader winelauncher
|
2003-11-30 07:18:43 +01:00
|
|
|
|
|
|
|
# Rules for testing
|
|
|
|
|
|
|
|
check test:: \$(SUBDIRS:%=%/__test__)
|
|
|
|
|
2006-03-20 20:47:58 +01:00
|
|
|
### Dependencies:
|
2003-11-30 07:18:43 +01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
close NEWMAKE;
|
2006-08-25 11:50:21 +02:00
|
|
|
update_file("programs/Makefile.in");
|
2006-07-10 20:59:06 +02:00
|
|
|
|
|
|
|
################################################################
|
|
|
|
# .gitignore file
|
|
|
|
|
2006-08-25 11:50:21 +02:00
|
|
|
open GITIGNORE, ">programs/.gitignore.new" or die "cannot create programs/.gitignore.new";
|
2006-07-10 20:59:06 +02:00
|
|
|
print GITIGNORE "# Automatically generated by make_dlls; DO NOT EDIT!!\n";
|
|
|
|
|
|
|
|
my @ignores =
|
|
|
|
(
|
|
|
|
"/Makeprog.rules",
|
|
|
|
"/wineapploader",
|
|
|
|
"/winelauncher",
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach my $dir (sort keys %alldirs)
|
|
|
|
{
|
|
|
|
push @ignores, "$dir/$dir";
|
|
|
|
}
|
|
|
|
|
|
|
|
print GITIGNORE join("\n", sort @ignores) . "\n";
|
|
|
|
|
|
|
|
close GITIGNORE;
|
2006-08-25 11:50:21 +02:00
|
|
|
update_file("programs/.gitignore");
|