#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
use strict;
# list of special dlls that can be switched on or off by configure
my %special_dlls =
(
- "ddraw" => "XFILES",
"glu32" => "GLU32FILES",
"glut32" => "GLUT32FILES",
"opengl32" => "OPENGLFILES",
- "d3d8" => "OPENGLFILES",
- "d3d9" => "OPENGLFILES",
- "d3dx8" => "OPENGLFILES",
"wined3d" => "OPENGLFILES",
- "x11drv" => "XFILES"
+ "winex11.drv" => "XFILES"
);
+sub needs_symlink($)
+{
+ (my $mod = $_[0]) =~ s/\.dll$//;
+ return $mod ne $directories{$_[0]};
+}
+
foreach my $i (split(/\s/,$makefiles))
{
my $module;
if ($module =~ /^lib.*\.a$/)
{
($staticlib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
+ die "invalid module $module in dir $staticlib_dirs{$module}\n" if "lib$staticlib_dirs{$module}.a" ne $module;
}
else
{
foreach my $mod (sort keys %directories)
{
next if defined($special_dlls{$directories{$mod}}); # skip special dlls
- $targets{$mod . ".so"} = 1;
+ $targets{$mod . ".so"} = 1 if needs_symlink($mod);
next unless defined $altnames{$mod};
foreach my $i (sort @{$altnames{$mod}})
{
- $targets16{sprintf("%s.so",$i)} = 1;
+ $targets16{$i . "16"} = $mod;
}
}
-foreach my $mod (sort keys %staticlib_dirs) { $targets{$mod} = 1; }
print NEWMAKE <<EOF;
print NEWMAKE <<EOF;
SYMLINKS_SO = \\
- \$(EXTRADIRS:%=%.dll.so) \\
\@WIN16_FILES\@ \\
EOF
printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
# Main target
-all: symlinks\$(DLLEXT)
+all: \$(BUILDSUBDIRS) symlinks\$(DLLEXT)
.PHONY: symlinks symlinks.so implib
symlinks: \$(BUILDSUBDIRS)
-x11drv.dll.so: winex11.drv.so
- \$(RM) \$@ && \$(LN_S) winex11.drv.so \$@
-
EOF
################################################################
# output the lib name -> directory rules
-print NEWMAKE <<EOF;
-
-# Map symlink name to the corresponding library
-
-EOF
-
+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;
-
- if (defined $altnames{$mod})
- {
- my $count = 0;
- foreach my $i (sort @{$altnames{$mod}})
- {
- if ($count++ == 3) { printf NEWMAKE "\\\n "; $count = 1; }
- printf NEWMAKE "%s.so ", $i;
- }
- printf NEWMAKE ": %s.so\n", $mod;
- printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s.so \$@\n\n", $mod;
- }
}
-foreach my $mod (sort keys %staticlib_dirs)
+
+print NEWMAKE "# Placeholders for 16-bit libraries\n\n";
+foreach my $mod (sort keys %directories)
{
- printf NEWMAKE "%s: %s/%s\n", $mod, $staticlib_dirs{$mod}, $mod;
- printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $staticlib_dirs{$mod}, $mod;
+ 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 "\n# Import libraries\n\n";
+print NEWMAKE "# Import libraries\n\n";
print NEWMAKE "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
my @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", $mod;
+ printf NEWMAKE " \\\n\t%s/%s", $staticlib_dirs{$mod}, $mod;
}
-
-print NEWMAKE "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
foreach my $mod (sort keys %importlibs)
{
my $dir = $directories{$mod};
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)
install-dev:: \$(INSTALLSUBDIRS:%=%/__install-dev__)
uninstall::
- -rmdir \$(dlldir)
+ -rmdir \$(DESTDIR)\$(dlldir)
clean::
- \$(RM) \$(IMPORT_SYMLINKS)
+ \$(RM) \$(IMPORT_SYMLINKS) \$(WIN16_FILES)
check test:: \$(BUILDSUBDIRS:%=%/__test__)