Commit c0d955e8 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Now runs in Perl strict mode.

Added ability to skip DLL from the tree.
parent 3e4381aa
......@@ -20,15 +20,17 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
$makefiles = `find . -name Makefile.in -print`;
use strict;
%imports = ();
%directories = ();
%altnames = ();
%linked_dlls = ();
my $makefiles = `find . -name Makefile.in -print`;
my %imports = ();
my %directories = ();
my %altnames = ();
my %linked_dlls = ();
# list of special dlls that can be switched on or off by configure
%special_dlls =
my %special_dlls =
(
"ddraw" => "XFILES",
"glu32" => "GLU32FILES",
......@@ -36,12 +38,20 @@ $makefiles = `find . -name Makefile.in -print`;
"x11drv" => "XFILES"
);
foreach $i (split(/\s/,$makefiles))
foreach my $i (split(/\s/,$makefiles))
{
my $module;
open MAKE,$i;
$module = undef;
while (<MAKE>)
{
chop;
# 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/);
if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
{
$module = $1;
......@@ -68,7 +78,8 @@ foreach $i (split(/\s/,$makefiles))
next;
}
}
push @{$imports{$module}}, "kernel32.dll" unless @{$imports{$module}} || $module eq "ntdll.dll";
close MAKE;
push @{$imports{$module}}, "kernel32.dll" unless !defined($module) || @{$imports{$module}} || $module eq "ntdll.dll";
}
open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
......@@ -91,16 +102,16 @@ EOF
printf NEWMAKE "# special configure-dependent targets\n\n";
my %specials = ();
foreach $mod (sort keys %special_dlls)
foreach my $mod (sort keys %special_dlls)
{
$specials{$special_dlls{$mod}} .= " " . $mod;
}
foreach $i (sort keys %specials)
foreach my $i (sort keys %specials)
{
printf NEWMAKE "%s =%s\n", $i, $specials{$i};
}
printf NEWMAKE "EXTRADIRS =";
foreach $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
foreach my $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
printf NEWMAKE "\n\n";
......@@ -113,7 +124,7 @@ print NEWMAKE <<EOF;
SUBDIRS = \\
EOF
printf NEWMAKE "\t\$(EXTRADIRS)";
foreach $dir (sort values %directories)
foreach my $dir (sort values %directories)
{
next if defined($special_dlls{$dir}); # skip special dlls
printf NEWMAKE " \\\n\t%s", $dir;
......@@ -125,12 +136,12 @@ printf NEWMAKE "\n";
# output the all: target
my %targets = (); # use a hash to get rid of duplicate target names
foreach $mod (sort keys %directories)
foreach my $mod (sort keys %directories)
{
next if defined($special_dlls{$directories{$mod}}); # skip special dlls
$targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
next unless defined $altnames{$mod};
foreach $i (sort @{$altnames{$mod}})
foreach my $i (sort @{$altnames{$mod}})
{
$targets{sprintf("%s\$(DLLEXT)",$i)} = 1;
}
......@@ -156,13 +167,13 @@ print NEWMAKE <<EOF;
EOF
foreach $mod (sort keys %directories)
foreach my $mod (sort keys %directories)
{
printf NEWMAKE "%s\$(DLLEXT)", $mod;
if (defined $altnames{$mod})
{
my $count = 1;
foreach $i (sort @{$altnames{$mod}})
foreach my $i (sort @{$altnames{$mod}})
{
if (!($count++ % 3)) { printf NEWMAKE " \\\n "; }
printf NEWMAKE " %s\$(DLLEXT)", $i;
......@@ -179,11 +190,11 @@ foreach $mod (sort keys %directories)
print NEWMAKE "# Inter-dll dependencies\n\n";
my @depends = ();
foreach $mod (sort keys %imports)
foreach my $mod (sort keys %imports)
{
my $count = 1;
my $dep = sprintf("%s/%s\$(DLLEXT): dummy", $directories{$mod}, $mod);
foreach $i (@{$imports{$mod}})
foreach my $i (@{$imports{$mod}})
{
if ($count++ >= 3)
{
......@@ -192,7 +203,7 @@ foreach $mod (sort keys %imports)
}
$dep .= sprintf(" %s\$(DLLEXT)", $i);
}
foreach $i (@{$linked_dlls{$mod}})
foreach my $i (@{$linked_dlls{$mod}})
{
if ($count++ >= 3)
{
......@@ -210,14 +221,14 @@ print NEWMAKE sort @depends;
################################################################
# output the linkable dlls special links
%linkable_dlls = ();
foreach $mod (keys %imports)
my %linkable_dlls = ();
foreach my $mod (keys %imports)
{
foreach $i (@{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
foreach my $i (@{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
}
print NEWMAKE "# Special targets for dlls that we need to link to\n\n";
foreach $mod (keys %linkable_dlls)
foreach my $mod (keys %linkable_dlls)
{
printf NEWMAKE "lib%s.\$(LIBEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment