2001-09-17 20:09:08 +00:00
|
|
|
#!/usr/bin/perl -w
|
2001-06-08 19:09:44 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2002-03-09 23:29:33 +00:00
|
|
|
# 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
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2002-05-21 18:29:31 +00:00
|
|
|
use strict;
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2002-05-21 18:29:31 +00:00
|
|
|
my $makefiles = `find . -name Makefile.in -print`;
|
|
|
|
|
|
|
|
my %directories = ();
|
2004-01-26 21:29:05 +00:00
|
|
|
my %implib_dirs = ();
|
2002-05-21 18:29:31 +00:00
|
|
|
my %altnames = ();
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
# list of special dlls that can be switched on or off by configure
|
2002-05-21 18:29:31 +00:00
|
|
|
my %special_dlls =
|
2001-09-17 20:09:08 +00:00
|
|
|
(
|
|
|
|
"ddraw" => "XFILES",
|
|
|
|
"glu32" => "GLU32FILES",
|
2003-12-02 04:11:09 +00:00
|
|
|
"glut32" => "GLUT32FILES",
|
2001-09-17 20:09:08 +00:00
|
|
|
"opengl32" => "OPENGLFILES",
|
2002-09-29 18:07:25 +00:00
|
|
|
"d3d8" => "OPENGLFILES",
|
2003-07-01 01:11:13 +00:00
|
|
|
"d3d9" => "OPENGLFILES",
|
2002-12-17 01:15:15 +00:00
|
|
|
"d3dx8" => "OPENGLFILES",
|
2003-11-14 03:50:35 +00:00
|
|
|
"wined3d" => "OPENGLFILES",
|
2001-09-17 20:09:08 +00:00
|
|
|
"x11drv" => "XFILES"
|
|
|
|
);
|
|
|
|
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $i (split(/\s/,$makefiles))
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2002-05-21 18:29:31 +00:00
|
|
|
my $module;
|
|
|
|
|
2002-08-09 01:22:40 +00:00
|
|
|
next if $i =~ /\/tests\/Makefile.in/;
|
|
|
|
|
2001-06-08 19:09:44 +00:00
|
|
|
open MAKE,$i;
|
2002-05-21 18:29:31 +00:00
|
|
|
|
|
|
|
$module = undef;
|
2001-06-08 19:09:44 +00:00
|
|
|
while (<MAKE>)
|
|
|
|
{
|
|
|
|
chop;
|
2002-05-21 18:29:31 +00:00
|
|
|
# EPP hack to disable this DLL... the MKDLL_SKIP comment must appear
|
|
|
|
# at the very top of the Makefile.in
|
|
|
|
last if (/^\#\s*MKDLL_SKIP/);
|
|
|
|
|
2001-06-08 19:09:44 +00:00
|
|
|
if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
|
|
|
|
{
|
|
|
|
$module = $1;
|
2004-01-26 21:29:05 +00:00
|
|
|
if ($module =~ /^lib.*\.a$/)
|
|
|
|
{
|
|
|
|
($implib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
|
|
|
|
}
|
2001-06-08 19:09:44 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
if (/^ALTNAMES\s*=\s*(.*)/)
|
|
|
|
{
|
|
|
|
my @list = split(/\s/,$1);
|
|
|
|
$altnames{$module} = \@list;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
}
|
2002-05-21 18:29:31 +00:00
|
|
|
close MAKE;
|
2001-06-08 19:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
|
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
################################################################
|
|
|
|
# makefile header
|
|
|
|
|
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
# Automatically generated by make_dlls; DO NOT EDIT!!
|
|
|
|
|
|
|
|
TOPSRCDIR = \@top_srcdir\@
|
|
|
|
TOPOBJDIR = ..
|
|
|
|
SRCDIR = \@srcdir\@
|
|
|
|
VPATH = \@srcdir\@
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
# output special dlls configure definitions
|
|
|
|
|
|
|
|
printf NEWMAKE "# special configure-dependent targets\n\n";
|
|
|
|
my %specials = ();
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $mod (sort keys %special_dlls)
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2001-09-17 20:09:08 +00:00
|
|
|
$specials{$special_dlls{$mod}} .= " " . $mod;
|
2001-06-08 19:09:44 +00:00
|
|
|
}
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $i (sort keys %specials)
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2001-09-17 20:09:08 +00:00
|
|
|
printf NEWMAKE "%s =%s\n", $i, $specials{$i};
|
2001-06-08 19:09:44 +00:00
|
|
|
}
|
2001-09-17 20:09:08 +00:00
|
|
|
printf NEWMAKE "EXTRADIRS =";
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
|
2001-09-17 20:09:08 +00:00
|
|
|
printf NEWMAKE "\n\n";
|
|
|
|
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
# output the subdirs list
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2002-05-23 02:47:16 +00:00
|
|
|
print NEWMAKE "# Subdir list\n\nBASEDIRS =";
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $dir (sort values %directories)
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2001-09-17 20:09:08 +00:00
|
|
|
next if defined($special_dlls{$dir}); # skip special dlls
|
2001-06-08 19:09:44 +00:00
|
|
|
printf NEWMAKE " \\\n\t%s", $dir;
|
|
|
|
}
|
|
|
|
|
2002-05-23 02:47:16 +00:00
|
|
|
printf NEWMAKE "\n\nSUBDIRS = \\\n\t\$(BASEDIRS)";
|
2004-01-26 21:29:05 +00:00
|
|
|
foreach my $dir (sort (keys %special_dlls, values %implib_dirs))
|
2002-05-23 02:47:16 +00:00
|
|
|
{
|
|
|
|
printf NEWMAKE " \\\n\t%s", $dir;
|
|
|
|
}
|
|
|
|
printf NEWMAKE <<EOF;
|
|
|
|
|
|
|
|
|
|
|
|
BUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)
|
2002-06-14 23:48:27 +00:00
|
|
|
|
|
|
|
INSTALLSUBDIRS = \$(BUILDSUBDIRS)
|
2002-05-23 02:47:16 +00:00
|
|
|
EOF
|
2001-09-17 20:09:08 +00:00
|
|
|
|
|
|
|
################################################################
|
|
|
|
# output the all: target
|
|
|
|
|
|
|
|
my %targets = (); # use a hash to get rid of duplicate target names
|
2002-10-02 02:34:09 +00:00
|
|
|
my %targets16 = ();
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $mod (sort keys %directories)
|
2001-09-17 20:09:08 +00:00
|
|
|
{
|
2002-03-20 22:19:06 +00:00
|
|
|
next if defined($special_dlls{$directories{$mod}}); # skip special dlls
|
2004-03-10 01:56:00 +00:00
|
|
|
$targets{$mod . ".so"} = 1;
|
2001-09-17 20:09:08 +00:00
|
|
|
next unless defined $altnames{$mod};
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $i (sort @{$altnames{$mod}})
|
2001-09-17 20:09:08 +00:00
|
|
|
{
|
2004-03-10 01:56:00 +00:00
|
|
|
$targets16{sprintf("%s.so",$i)} = 1;
|
2001-09-17 20:09:08 +00:00
|
|
|
}
|
|
|
|
}
|
2004-01-26 21:29:05 +00:00
|
|
|
foreach my $mod (sort keys %implib_dirs) { $targets{$mod} = 1; }
|
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
|
2002-03-20 22:19:06 +00:00
|
|
|
\@MAKE_RULES\@
|
|
|
|
|
2003-05-15 04:30:46 +00:00
|
|
|
# Symbolic links
|
|
|
|
|
2002-10-02 02:34:09 +00:00
|
|
|
WIN16_FILES = \\
|
|
|
|
EOF
|
|
|
|
printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets16 );
|
|
|
|
|
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
|
2004-03-10 01:56:00 +00:00
|
|
|
SYMLINKS_SO = \\
|
|
|
|
\$(EXTRADIRS:%=%.dll.so) \\
|
2002-10-02 02:34:09 +00:00
|
|
|
\@WIN16_FILES\@ \\
|
2001-09-17 20:09:08 +00:00
|
|
|
EOF
|
|
|
|
printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
|
|
|
|
|
2003-05-15 04:30:46 +00:00
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
|
|
|
|
# Main target
|
|
|
|
|
2004-03-10 01:56:00 +00:00
|
|
|
all: symlinks\$(DLLEXT)
|
|
|
|
|
|
|
|
.PHONY: symlinks symlinks.so implib
|
|
|
|
|
|
|
|
symlinks.so: \$(SYMLINKS_SO)
|
|
|
|
|
|
|
|
symlinks: \$(BUILDSUBDIRS)
|
|
|
|
|
2003-05-15 04:30:46 +00:00
|
|
|
EOF
|
2001-09-17 20:09:08 +00:00
|
|
|
|
|
|
|
################################################################
|
|
|
|
# output the lib name -> directory rules
|
|
|
|
|
2001-06-08 19:09:44 +00:00
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
|
2002-05-23 19:13:22 +00:00
|
|
|
# Map symlink name to the corresponding library
|
2001-06-08 19:09:44 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $mod (sort keys %directories)
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2004-03-10 01:56:00 +00:00
|
|
|
printf NEWMAKE "%s.so: %s/%s.so\n", $mod, $directories{$mod}, $mod;
|
|
|
|
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s.so \$@\n\n", $directories{$mod}, $mod;
|
2004-01-02 20:54:03 +00:00
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
if (defined $altnames{$mod})
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2004-01-02 20:54:03 +00:00
|
|
|
my $count = 0;
|
2002-05-21 18:29:31 +00:00
|
|
|
foreach my $i (sort @{$altnames{$mod}})
|
2001-06-08 19:09:44 +00:00
|
|
|
{
|
2004-01-02 20:54:03 +00:00
|
|
|
if ($count++ == 3) { printf NEWMAKE "\\\n "; $count = 1; }
|
2004-03-10 01:56:00 +00:00
|
|
|
printf NEWMAKE "%s.so ", $i;
|
2001-06-08 19:09:44 +00:00
|
|
|
}
|
2004-03-10 01:56:00 +00:00
|
|
|
printf NEWMAKE ": %s.so\n", $mod;
|
|
|
|
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s.so \$@\n\n", $mod;
|
2001-06-08 19:09:44 +00:00
|
|
|
}
|
|
|
|
}
|
2004-01-26 21:29:05 +00:00
|
|
|
foreach my $mod (sort keys %implib_dirs)
|
|
|
|
{
|
|
|
|
printf NEWMAKE "%s: %s/%s\n", $mod, $implib_dirs{$mod}, $mod;
|
|
|
|
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $implib_dirs{$mod}, $mod;
|
|
|
|
}
|
2001-09-17 20:09:08 +00:00
|
|
|
|
2002-12-12 22:03:14 +00:00
|
|
|
################################################################
|
|
|
|
# output the import libraries rules
|
|
|
|
|
|
|
|
my @implibs = grep /\.dll$/, keys %directories;
|
|
|
|
push @implibs, "winspool.drv";
|
|
|
|
|
|
|
|
print NEWMAKE "\n# Import libraries\n\nIMPORT_LIBS =";
|
|
|
|
foreach my $mod (sort @implibs)
|
|
|
|
{
|
|
|
|
my $def = $mod;
|
2002-12-15 01:20:54 +00:00
|
|
|
$def =~ s/\.(dll|drv)$//;
|
2004-08-11 20:59:09 +00:00
|
|
|
printf NEWMAKE " \\\n\tlib%s.\$(IMPLIBEXT)", $def;
|
2002-12-12 22:03:14 +00:00
|
|
|
}
|
2004-01-26 21:29:05 +00:00
|
|
|
foreach my $mod (sort keys %implib_dirs)
|
|
|
|
{
|
|
|
|
printf NEWMAKE " \\\n\t%s", $mod;
|
|
|
|
}
|
2002-12-12 22:03:14 +00:00
|
|
|
print NEWMAKE "\n\n";
|
2004-08-11 20:59:09 +00:00
|
|
|
print NEWMAKE "implib: \$(IMPORT_LIBS)\n\n";
|
2002-12-12 22:03:14 +00:00
|
|
|
|
|
|
|
foreach my $mod (sort @implibs)
|
|
|
|
{
|
|
|
|
my $dir = $directories{$mod};
|
|
|
|
my $def = $mod;
|
|
|
|
my $spec = $mod;
|
|
|
|
$spec =~ s/\.dll$//;
|
|
|
|
$def =~ s/\.(dll|drv)$//;
|
|
|
|
printf NEWMAKE "lib%s.def: %s/%s.spec.def\n", $def, $dir, $spec;
|
|
|
|
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s.spec.def \$@\n", $dir, $spec;
|
|
|
|
printf NEWMAKE "lib%s.a: %s/%s.spec.def\n", $def, $dir, $spec;
|
|
|
|
printf NEWMAKE "\t\$(DLLTOOL) -k -l \$@ -d %s/%s.spec.def\n\n", $dir, $spec;
|
|
|
|
}
|
|
|
|
foreach my $mod (sort @implibs)
|
|
|
|
{
|
|
|
|
my $dir = $directories{$mod};
|
|
|
|
my $spec = $mod;
|
|
|
|
$spec =~ s/\.dll$//;
|
|
|
|
printf NEWMAKE "%s/%s.spec.def: \$(WINEBUILD)\n", $dir, $spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print NEWMAKE <<EOF;
|
|
|
|
|
2004-08-11 20:59:09 +00:00
|
|
|
\$(BUILDSUBDIRS): \$(IMPORT_LIBS)
|
|
|
|
\$(INSTALLSUBDIRS:%=%/__install__): \$(IMPORT_LIBS)
|
2002-12-12 22:03:14 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
################################################################
|
|
|
|
# output the inter-dll dependencies and rules
|
|
|
|
|
2002-05-23 19:13:22 +00:00
|
|
|
print NEWMAKE "# Map library name to the corresponding directory\n\n";
|
|
|
|
|
|
|
|
foreach my $mod (sort keys %directories)
|
|
|
|
{
|
2004-03-10 01:56:00 +00:00
|
|
|
printf NEWMAKE "%s/%s.so: %s\n", $directories{$mod}, $mod, $directories{$mod};
|
2002-05-23 19:13:22 +00:00
|
|
|
}
|
2004-01-26 21:29:05 +00:00
|
|
|
foreach my $mod (sort keys %implib_dirs)
|
|
|
|
{
|
|
|
|
printf NEWMAKE "%s/%s: %s\n", $implib_dirs{$mod}, $mod, $implib_dirs{$mod};
|
|
|
|
}
|
2002-05-23 19:13:22 +00:00
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
################################################################
|
|
|
|
# makefile trailer
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
print NEWMAKE <<EOF;
|
2004-01-26 21:29:05 +00:00
|
|
|
|
2003-04-12 00:05:27 +00:00
|
|
|
# Rules for auto documentation
|
|
|
|
|
|
|
|
\$(SUBDIRS:%=%/__man__): dummy
|
|
|
|
cd `dirname \$@` && \$(MAKE) man
|
|
|
|
|
|
|
|
man: \$(SUBDIRS:%=%/__man__)
|
|
|
|
|
|
|
|
\$(SUBDIRS:%=%/__doc_html__): dummy
|
|
|
|
cd `dirname \$@` && \$(MAKE) doc-html
|
|
|
|
|
|
|
|
doc-html: \$(SUBDIRS:%=%/__doc_html__)
|
|
|
|
|
|
|
|
\$(SUBDIRS:%=%/__doc_sgml__): dummy
|
|
|
|
cd `dirname \$@` && \$(MAKE) doc-sgml
|
|
|
|
|
|
|
|
doc-sgml: \$(SUBDIRS:%=%/__doc_sgml__)
|
|
|
|
|
2004-03-10 01:56:00 +00:00
|
|
|
.PHONY: man doc-html doc-sgml \$(SUBDIRS:%=%/__man__) \$(SUBDIRS:%=%/__doc_html__) \$(SUBDIRS:%=%/__doc_sgml__)
|
2003-04-12 00:05:27 +00:00
|
|
|
|
2001-09-17 20:09:08 +00:00
|
|
|
# Misc rules
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2004-08-11 20:59:09 +00:00
|
|
|
install install-dev:: \$(IMPORT_LIBS)
|
2002-12-12 22:03:14 +00:00
|
|
|
\$(MKINSTALLDIRS) \$(dlldir)
|
2004-08-11 20:59:09 +00:00
|
|
|
for f in \$(IMPORT_LIBS); do \$(INSTALL_DATA) \$\$f \$(dlldir)/\$\$f; done
|
2002-12-12 22:03:14 +00:00
|
|
|
|
2003-10-11 01:00:35 +00:00
|
|
|
install install-lib:: \$(INSTALLSUBDIRS:%=%/__install__)
|
|
|
|
|
2002-06-14 23:48:27 +00:00
|
|
|
uninstall::
|
2004-08-11 20:59:09 +00:00
|
|
|
-cd \$(dlldir) && \$(RM) \$(IMPORT_LIBS)
|
2002-03-20 22:19:06 +00:00
|
|
|
-rmdir \$(dlldir)
|
2001-06-08 19:09:44 +00:00
|
|
|
|
2002-12-12 22:03:14 +00:00
|
|
|
clean::
|
2004-08-11 20:59:09 +00:00
|
|
|
\$(RM) \$(IMPORT_LIBS) \$(SYMLINKS)
|
2002-12-12 22:03:14 +00:00
|
|
|
|
2002-05-23 02:47:16 +00:00
|
|
|
check test:: \$(BUILDSUBDIRS:%=%/__test__)
|
2002-01-14 19:56:46 +00:00
|
|
|
|
2002-09-06 19:46:00 +00:00
|
|
|
crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__)
|
|
|
|
|
2002-05-23 02:47:16 +00:00
|
|
|
checklink:: \$(BUILDSUBDIRS:%=%/__checklink__)
|
2002-06-14 23:48:27 +00:00
|
|
|
|
|
|
|
### Dependencies:
|
2001-06-08 19:09:44 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
close NEWMAKE;
|
|
|
|
rename "Makefile.in.new", "Makefile.in";
|
|
|
|
printf "Successfully updated Makefile.in\n";
|