dlls: Merged the make_dlls script into the global make_makefiles.
This commit is contained in:
parent
8b95d95eb8
commit
0134db6e9b
|
@ -1,4 +1,4 @@
|
||||||
# Automatically generated by make_dlls; DO NOT EDIT!!
|
# Automatically generated by make_makefiles; DO NOT EDIT!!
|
||||||
*/tests/*.ok
|
*/tests/*.ok
|
||||||
*/tests/testlist.c
|
*/tests/testlist.c
|
||||||
/Makedll.rules
|
/Makedll.rules
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Automatically generated by make_dlls; DO NOT EDIT!!
|
# Automatically generated by make_makefiles; DO NOT EDIT!!
|
||||||
|
|
||||||
TOPSRCDIR = @top_srcdir@
|
TOPSRCDIR = @top_srcdir@
|
||||||
TOPOBJDIR = ..
|
TOPOBJDIR = ..
|
||||||
|
|
387
dlls/make_dlls
387
dlls/make_dlls
|
@ -1,387 +0,0 @@
|
||||||
#!/usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# Update the dll dependencies in the dlls main Makefile.in.
|
|
||||||
#
|
|
||||||
# Copyright 2001 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
|
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
#
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my %directories = ();
|
|
||||||
my %testdirs = ();
|
|
||||||
my %importlibs = ();
|
|
||||||
my %static_implibs = ();
|
|
||||||
my %staticlib_dirs = ();
|
|
||||||
my %altnames = ();
|
|
||||||
|
|
||||||
# list of special dlls that can be switched on or off by configure
|
|
||||||
my %special_dlls =
|
|
||||||
(
|
|
||||||
"glu32" => "GLU32FILES",
|
|
||||||
"opengl32" => "OPENGLFILES",
|
|
||||||
"wined3d" => "OPENGLFILES",
|
|
||||||
"winex11.drv" => "XFILES",
|
|
||||||
"winequartz.drv" => "QUARTZFILES"
|
|
||||||
);
|
|
||||||
|
|
||||||
sub needs_symlink($)
|
|
||||||
{
|
|
||||||
(my $mod = $_[0]) =~ s/\.dll$//;
|
|
||||||
return $mod ne $directories{$_[0]};
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (-x "./config.status" && $file =~ /(.*Makefile)\.in$/)
|
|
||||||
{
|
|
||||||
system "./config.status", $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# if we are inside the dlls dir, go up one level
|
|
||||||
if (! -f "configure.ac" && -f "../configure.ac") { chdir(".."); }
|
|
||||||
|
|
||||||
my @args = @ARGV;
|
|
||||||
if (!@args) { @args = map { s/^(.*)\.in/$1/; $_; } split(/\s/,`find dlls -name Makefile.in -print`); }
|
|
||||||
|
|
||||||
foreach my $i (@args)
|
|
||||||
{
|
|
||||||
if ($i =~ /dlls\/(.*)\/tests\/Makefile/)
|
|
||||||
{
|
|
||||||
$testdirs{$1} = "$1/tests";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
open MAKE, "$i.in" or die "cannot open $i.in\n";
|
|
||||||
|
|
||||||
my $module = undef;
|
|
||||||
my $dir = $i;
|
|
||||||
|
|
||||||
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;
|
|
||||||
if ($module =~ /^lib.*\.a$/)
|
|
||||||
{
|
|
||||||
($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/^dlls\/(.*)\/[^\/]+$/$1/;
|
|
||||||
}
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
if (/^IMPORTLIB\s*=\s*([a-zA-Z0-9_.]+)\.\$\(IMPLIBEXT\)/)
|
|
||||||
{
|
|
||||||
$importlibs{$module} = $1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
if (/^IMPLIB_SRCS\s*=/)
|
|
||||||
{
|
|
||||||
$static_implibs{$module} = 1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
if (/^SPEC_SRCS16\s*=\s*(.*)/)
|
|
||||||
{
|
|
||||||
my $specs = $1;
|
|
||||||
while ($specs =~ /\s*(.*)\\$/) { $specs = $1 . <MAKE>; }
|
|
||||||
my @list = split(/\s+/,$specs);
|
|
||||||
@list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @list;
|
|
||||||
$altnames{$module} = \@list;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close MAKE;
|
|
||||||
}
|
|
||||||
|
|
||||||
open NEWMAKE,">dlls/Makefile.in.new" or die "cannot create dlls/Makefile.in.new";
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# 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 = ();
|
|
||||||
foreach my $mod (sort keys %special_dlls)
|
|
||||||
{
|
|
||||||
$specials{$special_dlls{$mod}} .= " " . $mod;
|
|
||||||
}
|
|
||||||
foreach my $i (sort keys %specials)
|
|
||||||
{
|
|
||||||
printf NEWMAKE "%s =%s\n", $i, $specials{$i};
|
|
||||||
}
|
|
||||||
printf NEWMAKE "EXTRADIRS =";
|
|
||||||
foreach my $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
|
|
||||||
printf NEWMAKE "\n\n";
|
|
||||||
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# output the subdirs list
|
|
||||||
|
|
||||||
print NEWMAKE "# Subdir list\n\nBASEDIRS =";
|
|
||||||
foreach my $dir (sort values %directories)
|
|
||||||
{
|
|
||||||
next if defined($special_dlls{$dir}); # skip special dlls
|
|
||||||
printf NEWMAKE " \\\n\t%s", $dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
print NEWMAKE "\n\nIMPLIBSUBDIRS = \\\n\t";
|
|
||||||
print NEWMAKE join " \\\n\t", sort values %staticlib_dirs;
|
|
||||||
|
|
||||||
print NEWMAKE "\n\nTESTSUBDIRS = \\\n\t";
|
|
||||||
print NEWMAKE join " \\\n\t", sort values %testdirs;
|
|
||||||
|
|
||||||
print NEWMAKE "\n\nSUBDIRS = \\\n\t";
|
|
||||||
print NEWMAKE join " \\\n\t", "\$(BASEDIRS)", "\$(IMPLIBSUBDIRS)", "\$(TESTSUBDIRS)",
|
|
||||||
sort keys %special_dlls;
|
|
||||||
print NEWMAKE <<EOF;
|
|
||||||
|
|
||||||
|
|
||||||
BUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(TESTSUBDIRS)
|
|
||||||
INSTALLSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(IMPLIBSUBDIRS)
|
|
||||||
DOCSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# output the all: target
|
|
||||||
|
|
||||||
my %targets = (); # use a hash to get rid of duplicate target names
|
|
||||||
my %targets16 = ();
|
|
||||||
foreach my $mod (sort keys %directories)
|
|
||||||
{
|
|
||||||
next if defined($special_dlls{$directories{$mod}}); # skip special dlls
|
|
||||||
$targets{$mod . ".so"} = 1 if needs_symlink($mod);
|
|
||||||
next unless defined $altnames{$mod};
|
|
||||||
foreach my $i (sort @{$altnames{$mod}})
|
|
||||||
{
|
|
||||||
$targets16{$i . "16"} = $mod;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print NEWMAKE <<EOF;
|
|
||||||
|
|
||||||
\@MAKE_RULES\@
|
|
||||||
|
|
||||||
# Symbolic links
|
|
||||||
|
|
||||||
WIN16_FILES = \\
|
|
||||||
EOF
|
|
||||||
printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets16 );
|
|
||||||
|
|
||||||
print NEWMAKE <<EOF;
|
|
||||||
|
|
||||||
SYMLINKS_SO = \\
|
|
||||||
\@WIN16_FILES\@ \\
|
|
||||||
EOF
|
|
||||||
printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
|
|
||||||
|
|
||||||
print NEWMAKE <<EOF;
|
|
||||||
|
|
||||||
# Main target
|
|
||||||
|
|
||||||
all: \$(BUILDSUBDIRS) symlinks\$(DLLEXT)
|
|
||||||
|
|
||||||
.PHONY: symlinks symlinks.so implib
|
|
||||||
|
|
||||||
symlinks.so: \$(SYMLINKS_SO)
|
|
||||||
|
|
||||||
symlinks: \$(BUILDSUBDIRS)
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# output the lib name -> directory rules
|
|
||||||
|
|
||||||
print NEWMAKE "# Map symlink name to the corresponding library\n\n";
|
|
||||||
foreach my $mod (sort keys %directories)
|
|
||||||
{
|
|
||||||
next unless needs_symlink($mod);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
print NEWMAKE "# Placeholders for 16-bit libraries\n\n";
|
|
||||||
foreach my $mod (sort keys %directories)
|
|
||||||
{
|
|
||||||
next unless defined $altnames{$mod};
|
|
||||||
printf NEWMAKE "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
|
|
||||||
printf NEWMAKE "\techo \"%s\" >\$\@\n\n", $mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# output the import libraries rules
|
|
||||||
|
|
||||||
print NEWMAKE "# Import libraries\n\n";
|
|
||||||
print NEWMAKE "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
|
|
||||||
|
|
||||||
my @lib_symlinks = ();
|
|
||||||
foreach my $mod (sort keys %importlibs)
|
|
||||||
{
|
|
||||||
my $dir = $directories{$mod};
|
|
||||||
my $lib = $importlibs{$mod};
|
|
||||||
if ($lib ne "lib" . $dir) { push @lib_symlinks, $mod; }
|
|
||||||
}
|
|
||||||
print NEWMAKE "IMPORT_SYMLINKS =";
|
|
||||||
foreach my $mod (sort @lib_symlinks)
|
|
||||||
{
|
|
||||||
printf NEWMAKE " \\\n\t%s.\$(IMPLIBEXT)", $importlibs{$mod};
|
|
||||||
}
|
|
||||||
|
|
||||||
print NEWMAKE "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
|
|
||||||
foreach my $mod (sort keys %staticlib_dirs)
|
|
||||||
{
|
|
||||||
printf NEWMAKE " \\\n\t%s/%s", $staticlib_dirs{$mod}, $mod;
|
|
||||||
}
|
|
||||||
foreach my $mod (sort keys %importlibs)
|
|
||||||
{
|
|
||||||
my $dir = $directories{$mod};
|
|
||||||
my $def = $mod;
|
|
||||||
$def =~ s/\.(dll|drv)$//;
|
|
||||||
printf NEWMAKE " \\\n\t%s/lib%s.\$(IMPLIBEXT)", $dir, $def;
|
|
||||||
printf NEWMAKE " \\\n\t%s/lib%s.\$(STATIC_IMPLIBEXT)", $dir, $def if $static_implibs{$mod};
|
|
||||||
}
|
|
||||||
print NEWMAKE "\n\n";
|
|
||||||
print NEWMAKE "implib: \$(IMPORT_LIBS)\n\n";
|
|
||||||
|
|
||||||
foreach my $mod (sort keys %importlibs)
|
|
||||||
{
|
|
||||||
my $dir = $directories{$mod};
|
|
||||||
my $lib = $importlibs{$mod};
|
|
||||||
my $spec = $mod;
|
|
||||||
$spec =~ s/\.dll$//;
|
|
||||||
printf NEWMAKE "%s/%s.\$(IMPLIBEXT): %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
|
|
||||||
printf NEWMAKE "\t\@cd %s && \$(MAKE) %s.\$(IMPLIBEXT)\n\n", $dir, $lib;
|
|
||||||
next unless $static_implibs{$mod};
|
|
||||||
printf NEWMAKE "%s/%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
|
|
||||||
printf NEWMAKE "\t\@cd %s && \$(MAKE) %s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
|
|
||||||
}
|
|
||||||
foreach my $mod (sort @lib_symlinks)
|
|
||||||
{
|
|
||||||
my $dir = $directories{$mod};
|
|
||||||
my $lib = $importlibs{$mod} . ".\$(IMPLIBEXT)";
|
|
||||||
printf NEWMAKE "%s: %s/%s\n", $lib, $dir, $lib;
|
|
||||||
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $dir, $lib;
|
|
||||||
}
|
|
||||||
|
|
||||||
print NEWMAKE <<EOF;
|
|
||||||
\$(BUILDSUBDIRS): \$(IMPORT_LIBS)
|
|
||||||
\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# output the inter-dll dependencies and rules
|
|
||||||
|
|
||||||
print NEWMAKE "# Map library name to the corresponding directory\n\n";
|
|
||||||
|
|
||||||
foreach my $mod (sort keys %directories)
|
|
||||||
{
|
|
||||||
next unless needs_symlink($mod);
|
|
||||||
printf NEWMAKE "%s/%s.so: %s\n", $directories{$mod}, $mod, $directories{$mod};
|
|
||||||
}
|
|
||||||
foreach my $mod (sort keys %staticlib_dirs)
|
|
||||||
{
|
|
||||||
printf NEWMAKE "%s/%s: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
|
|
||||||
}
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# makefile trailer
|
|
||||||
|
|
||||||
print NEWMAKE <<EOF;
|
|
||||||
|
|
||||||
# Misc rules
|
|
||||||
|
|
||||||
install-lib:: \$(INSTALLSUBDIRS:%=%/__install-lib__)
|
|
||||||
|
|
||||||
install-dev:: \$(INSTALLSUBDIRS:%=%/__install-dev__)
|
|
||||||
|
|
||||||
uninstall::
|
|
||||||
-rmdir \$(DESTDIR)\$(dlldir)
|
|
||||||
|
|
||||||
clean::
|
|
||||||
\$(RM) \$(IMPORT_SYMLINKS) \$(WIN16_FILES)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
close NEWMAKE;
|
|
||||||
update_file("dlls/Makefile.in");
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
# .gitignore file
|
|
||||||
|
|
||||||
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 =
|
|
||||||
(
|
|
||||||
"/Makedll.rules",
|
|
||||||
"/Makeimplib.rules",
|
|
||||||
"/Maketest.rules",
|
|
||||||
"*/tests/testlist.c",
|
|
||||||
"*/tests/*.ok",
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach my $mod (sort @lib_symlinks)
|
|
||||||
{
|
|
||||||
push @ignores, "/$importlibs{$mod}.def";
|
|
||||||
}
|
|
||||||
foreach my $mod (sort keys %directories)
|
|
||||||
{
|
|
||||||
next unless defined $altnames{$mod};
|
|
||||||
push @ignores, map { "/" . $_ . "16"; } @{$altnames{$mod}};
|
|
||||||
}
|
|
||||||
foreach my $mod (sort keys %importlibs)
|
|
||||||
{
|
|
||||||
my $dir = $directories{$mod};
|
|
||||||
my $def = $mod;
|
|
||||||
$def =~ s/\.(dll|drv)$//;
|
|
||||||
push @ignores, "$dir/lib$def.def";
|
|
||||||
}
|
|
||||||
|
|
||||||
print GITIGNORE join("\n", sort @ignores) . "\n";
|
|
||||||
|
|
||||||
close GITIGNORE;
|
|
||||||
update_file("dlls/.gitignore");
|
|
|
@ -57,6 +57,16 @@ my %dont_install =
|
||||||
"winetest" => 1,
|
"winetest" => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Special dlls that can be switched on or off by configure
|
||||||
|
my %special_dlls =
|
||||||
|
(
|
||||||
|
"glu32" => "GLU32FILES",
|
||||||
|
"opengl32" => "OPENGLFILES",
|
||||||
|
"wined3d" => "OPENGLFILES",
|
||||||
|
"winex11.drv" => "XFILES",
|
||||||
|
"winequartz.drv" => "QUARTZFILES"
|
||||||
|
);
|
||||||
|
|
||||||
my (@makefiles, %makefiles);
|
my (@makefiles, %makefiles);
|
||||||
|
|
||||||
# update a file if changed
|
# update a file if changed
|
||||||
|
@ -132,9 +142,9 @@ sub parse_makefile($)
|
||||||
$make{"=rules"} = $makerules{$var};
|
$make{"=rules"} = $makerules{$var};
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
|
if (/^(MODULE|IMPORTLIB|IMPLIB_SRCS|SPEC_SRCS16)\s*=\s*(.*)/)
|
||||||
{
|
{
|
||||||
$make{"MODULE"} = $1;
|
$make{$1} = $2;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
|
if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
|
||||||
|
@ -252,8 +262,258 @@ replace_in_file( "Makefile.in", '^ALL_MAKEFILES\s*=', undef, @lines );
|
||||||
################################################################
|
################################################################
|
||||||
# update dlls/Makefile.in
|
# update dlls/Makefile.in
|
||||||
|
|
||||||
my @dll_makefiles = grep /^dlls\//, @makefiles;
|
sub update_dlls(@)
|
||||||
system "dlls/make_dlls", @dll_makefiles;
|
{
|
||||||
|
my (%directories, %testdirs, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
|
||||||
|
my $text = "";
|
||||||
|
|
||||||
|
my @ignores =
|
||||||
|
(
|
||||||
|
"/Makedll.rules",
|
||||||
|
"/Makeimplib.rules",
|
||||||
|
"/Maketest.rules",
|
||||||
|
"*/tests/testlist.c",
|
||||||
|
"*/tests/*.ok",
|
||||||
|
);
|
||||||
|
|
||||||
|
sub needs_symlink($$)
|
||||||
|
{
|
||||||
|
my ($mod, $dir) = @_;
|
||||||
|
$mod =~ s/\.dll$//;
|
||||||
|
return $mod ne $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $make (@_)
|
||||||
|
{
|
||||||
|
if ($make =~ /dlls\/(.*)\/tests\/Makefile/)
|
||||||
|
{
|
||||||
|
$testdirs{$1} = "$1/tests";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
my %makefile = %{$makefiles{$make}};
|
||||||
|
|
||||||
|
next unless defined $makefile{"MODULE"};
|
||||||
|
my $module = $makefile{"MODULE"};
|
||||||
|
|
||||||
|
if ($module =~ /^lib.*\.a$/)
|
||||||
|
{
|
||||||
|
($staticlib_dirs{$module} = $make) =~ s/^dlls\/(.*)\/[^\/]+$/$1/;
|
||||||
|
die "invalid module $module in dir $staticlib_dirs{$module}\n" if "lib$staticlib_dirs{$module}.a" ne $module;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
($directories{$module} = $make) =~ s/^dlls\/(.*)\/[^\/]+$/$1/;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined $makefile{"IMPORTLIB"})
|
||||||
|
{
|
||||||
|
if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)\.\$\(IMPLIBEXT\)/)
|
||||||
|
{
|
||||||
|
$importlibs{$module} = $1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
die "invalid importlib name $makefile{IMPORTLIB} in $make";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
|
||||||
|
|
||||||
|
if (defined $makefile{"SPEC_SRCS16"})
|
||||||
|
{
|
||||||
|
my @list = split(/\s+/, $makefile{"SPEC_SRCS16"});
|
||||||
|
@list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @list;
|
||||||
|
$altnames{$module} = \@list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# output special dlls configure definitions
|
||||||
|
|
||||||
|
$text .= "# special configure-dependent targets\n\n";
|
||||||
|
my %specials = ();
|
||||||
|
foreach my $mod (sort keys %special_dlls)
|
||||||
|
{
|
||||||
|
$specials{$special_dlls{$mod}} .= " " . $mod;
|
||||||
|
}
|
||||||
|
foreach my $i (sort keys %specials)
|
||||||
|
{
|
||||||
|
$text .= $i . " =" . $specials{$i} . "\n";
|
||||||
|
}
|
||||||
|
$text .= "EXTRADIRS =";
|
||||||
|
foreach my $i (sort keys %specials) { $text .= sprintf " \@%s\@", $i; }
|
||||||
|
$text .= "\n\n";
|
||||||
|
|
||||||
|
# output the subdirs list
|
||||||
|
|
||||||
|
$text .= "# Subdir list\n\n";
|
||||||
|
$text .= "BASEDIRS =";
|
||||||
|
foreach my $dir (sort values %directories)
|
||||||
|
{
|
||||||
|
next if defined($special_dlls{$dir}); # skip special dlls
|
||||||
|
$text .= " \\\n\t" . $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "\n\nIMPLIBSUBDIRS = \\\n\t";
|
||||||
|
$text .= join " \\\n\t", sort values %staticlib_dirs;
|
||||||
|
|
||||||
|
$text .= "\n\nTESTSUBDIRS = \\\n\t";
|
||||||
|
$text .= join " \\\n\t", sort values %testdirs;
|
||||||
|
|
||||||
|
$text .= "\n\nSUBDIRS = \\\n\t";
|
||||||
|
$text .= join " \\\n\t", "\$(BASEDIRS)", "\$(IMPLIBSUBDIRS)", "\$(TESTSUBDIRS)", sort keys %special_dlls;
|
||||||
|
|
||||||
|
$text .= "\n\nBUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(TESTSUBDIRS)\n";
|
||||||
|
$text .= "INSTALLSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(IMPLIBSUBDIRS)\n";
|
||||||
|
$text .= "DOCSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)\n";
|
||||||
|
|
||||||
|
# output the all: target
|
||||||
|
|
||||||
|
my %targets = (); # use a hash to get rid of duplicate target names
|
||||||
|
my %targets16 = ();
|
||||||
|
foreach my $mod (sort keys %directories)
|
||||||
|
{
|
||||||
|
next if defined($special_dlls{$directories{$mod}}); # skip special dlls
|
||||||
|
$targets{$mod . ".so"} = 1 if needs_symlink($mod, $directories{$mod});
|
||||||
|
next unless defined $altnames{$mod};
|
||||||
|
foreach my $i (sort @{$altnames{$mod}})
|
||||||
|
{
|
||||||
|
$targets16{$i . "16"} = $mod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "\n\@MAKE_RULES\@\n\n";
|
||||||
|
$text .= "# Symbolic links\n\n";
|
||||||
|
$text .= "WIN16_FILES = \\\n";
|
||||||
|
$text .= "\t" . join( " \\\n\t", sort keys %targets16 ) . "\n\n";
|
||||||
|
$text .= "SYMLINKS_SO = \\\n";
|
||||||
|
$text .= "\t\@WIN16_FILES\@ \\\n";
|
||||||
|
$text .= "\t" . join( " \\\n\t", sort keys %targets ) . "\n\n";
|
||||||
|
$text .= "# Main target\n\n";
|
||||||
|
$text .= "all: \$(BUILDSUBDIRS) symlinks\$(DLLEXT)\n\n";
|
||||||
|
$text .= ".PHONY: symlinks symlinks.so implib\n\n";
|
||||||
|
$text .= "symlinks.so: \$(SYMLINKS_SO)\n\n";
|
||||||
|
$text .= "symlinks: \$(BUILDSUBDIRS)\n\n";
|
||||||
|
|
||||||
|
# output the lib name -> directory rules
|
||||||
|
|
||||||
|
$text .= "# Map symlink name to the corresponding library\n\n";
|
||||||
|
foreach my $mod (sort keys %directories)
|
||||||
|
{
|
||||||
|
next unless needs_symlink($mod, $directories{$mod});
|
||||||
|
$text .= sprintf "%s.so: %s/%s.so\n", $mod, $directories{$mod}, $mod;
|
||||||
|
$text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.so \$@\n\n", $directories{$mod}, $mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "# Placeholders for 16-bit libraries\n\n";
|
||||||
|
foreach my $mod (sort keys %directories)
|
||||||
|
{
|
||||||
|
next unless defined $altnames{$mod};
|
||||||
|
$text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
|
||||||
|
$text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
# output the import libraries rules
|
||||||
|
|
||||||
|
$text .= "# Import libraries\n\n";
|
||||||
|
$text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
|
||||||
|
|
||||||
|
my @lib_symlinks = ();
|
||||||
|
foreach my $mod (sort keys %importlibs)
|
||||||
|
{
|
||||||
|
my $dir = $directories{$mod};
|
||||||
|
my $lib = $importlibs{$mod};
|
||||||
|
if ($lib ne "lib" . $dir) { push @lib_symlinks, $mod; }
|
||||||
|
}
|
||||||
|
$text .= "IMPORT_SYMLINKS =";
|
||||||
|
foreach my $mod (sort @lib_symlinks)
|
||||||
|
{
|
||||||
|
$text .= sprintf " \\\n\t%s.\$(IMPLIBEXT)", $importlibs{$mod};
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
|
||||||
|
foreach my $mod (sort keys %staticlib_dirs)
|
||||||
|
{
|
||||||
|
$text .= sprintf " \\\n\t%s/%s", $staticlib_dirs{$mod}, $mod;
|
||||||
|
}
|
||||||
|
foreach my $mod (sort keys %importlibs)
|
||||||
|
{
|
||||||
|
my $dir = $directories{$mod};
|
||||||
|
my $def = $mod;
|
||||||
|
$def =~ s/\.(dll|drv)$//;
|
||||||
|
$text .= sprintf " \\\n\t%s/lib%s.\$(IMPLIBEXT)", $dir, $def;
|
||||||
|
next unless defined $static_implibs{$mod};
|
||||||
|
$text .= sprintf " \\\n\t%s/lib%s.\$(STATIC_IMPLIBEXT)", $dir, $def
|
||||||
|
}
|
||||||
|
$text .= "\n\n";
|
||||||
|
$text .= "implib: \$(IMPORT_LIBS)\n\n";
|
||||||
|
|
||||||
|
foreach my $mod (sort keys %importlibs)
|
||||||
|
{
|
||||||
|
my $dir = $directories{$mod};
|
||||||
|
my $lib = $importlibs{$mod};
|
||||||
|
my $spec = $mod;
|
||||||
|
$spec =~ s/\.dll$//;
|
||||||
|
$text .= sprintf "%s/%s.\$(IMPLIBEXT): %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
|
||||||
|
$text .= sprintf "\t\@cd %s && \$(MAKE) %s.\$(IMPLIBEXT)\n\n", $dir, $lib;
|
||||||
|
next unless $static_implibs{$mod};
|
||||||
|
$text .= sprintf "%s/%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
|
||||||
|
$text .= sprintf "\t\@cd %s && \$(MAKE) %s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
|
||||||
|
}
|
||||||
|
foreach my $mod (sort @lib_symlinks)
|
||||||
|
{
|
||||||
|
my $dir = $directories{$mod};
|
||||||
|
my $lib = $importlibs{$mod} . ".\$(IMPLIBEXT)";
|
||||||
|
$text .= sprintf "%s: %s/%s\n", $lib, $dir, $lib;
|
||||||
|
$text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $dir, $lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
|
||||||
|
$text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
|
||||||
|
|
||||||
|
# output the inter-dll dependencies and rules
|
||||||
|
|
||||||
|
$text .= "# Map library name to the corresponding directory\n\n";
|
||||||
|
|
||||||
|
foreach my $mod (sort keys %directories)
|
||||||
|
{
|
||||||
|
next unless needs_symlink($mod, $directories{$mod});
|
||||||
|
$text .= sprintf "%s/%s.so: %s\n", $directories{$mod}, $mod, $directories{$mod};
|
||||||
|
}
|
||||||
|
foreach my $mod (sort keys %staticlib_dirs)
|
||||||
|
{
|
||||||
|
$text .= sprintf "%s/%s: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
|
||||||
|
}
|
||||||
|
$text .= "\n# Misc rules\n";
|
||||||
|
|
||||||
|
replace_in_file( "dlls/Makefile.in",
|
||||||
|
'^# special configure-dependent targets',
|
||||||
|
'^# Misc rules',
|
||||||
|
$text );
|
||||||
|
|
||||||
|
# .gitignore file
|
||||||
|
|
||||||
|
foreach my $mod (sort @lib_symlinks)
|
||||||
|
{
|
||||||
|
push @ignores, "/$importlibs{$mod}.def";
|
||||||
|
}
|
||||||
|
foreach my $mod (sort keys %directories)
|
||||||
|
{
|
||||||
|
next unless defined $altnames{$mod};
|
||||||
|
push @ignores, map { "/" . $_ . "16"; } @{$altnames{$mod}};
|
||||||
|
}
|
||||||
|
foreach my $mod (sort keys %importlibs)
|
||||||
|
{
|
||||||
|
my $dir = $directories{$mod};
|
||||||
|
my $def = $mod;
|
||||||
|
$def =~ s/\.(dll|drv)$//;
|
||||||
|
push @ignores, "$dir/lib$def.def";
|
||||||
|
}
|
||||||
|
|
||||||
|
replace_in_file( "dlls/.gitignore", undef, undef,
|
||||||
|
"# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
|
||||||
|
join("\n", sort @ignores), "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
|
@ -297,4 +557,5 @@ sub update_progs(@)
|
||||||
join("\n", sort @ignores), "\n" );
|
join("\n", sort @ignores), "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_dlls( sort grep /^dlls\//, @makefiles );
|
||||||
update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
|
update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
|
||||||
|
|
Loading…
Reference in New Issue