Build and load import libraries directly from the dll directory where

possible, and only create symlinks for directories that don't have the
correct name.
This commit is contained in:
Alexandre Julliard 2005-05-10 13:21:04 +00:00
parent 1c5671df07
commit 15ac6847e0
6 changed files with 645 additions and 1311 deletions

View File

@ -23,6 +23,7 @@ ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
STATICIMPLIB= $(IMPORTLIB:.def=.def.a)
DLL_LDPATH = -L$(DLLDIR) $(ALL_IMPORTS:%=-L$(DLLDIR)/%)
all: $(MODULE)$(DLLEXT) $(SUBDIRS)
@ -31,12 +32,12 @@ all: $(MODULE)$(DLLEXT) $(SUBDIRS)
# Rules for .so files
$(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
# Rules for .dll files
$(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in
$(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
$(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for import libraries
@ -79,7 +80,7 @@ crosstest:: $(SUBDIRS:%=%/__crosstest__)
# Rule to explicitly generate the .spec.c for debugging
$(MAINSPEC).c: $(MAINSPEC) $(ALL_OBJS)
$(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%)
$(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%)
# Rules for auto documentation

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,7 @@ C_SRCS = $(CTESTS)
EXTRA_SRCS = $(TESTLIST)
EXTRA_OBJS = $(TESTLIST:.c=.o)
ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
DLL_LDPATH = -L$(DLLDIR) $(IMPORTS:%=-L$(DLLDIR)/%)
CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) $(TESTLIST:.c=.cross.o)
@ -36,7 +37,7 @@ all: $(TESTPROGRAM)
# Rules for .so main module
$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(DLL_LDPATH) -L$(LIBDIR) $(ALL_LIBS)
# Rules for .exe main module

View File

@ -25,7 +25,9 @@ use strict;
my $makefiles = `find . -name Makefile.in -print`;
my %directories = ();
my %implib_dirs = ();
my %importlibs = ();
my %static_implibs = ();
my %staticlib_dirs = ();
my %altnames = ();
# list of special dlls that can be switched on or off by configure
@ -63,7 +65,7 @@ foreach my $i (split(/\s/,$makefiles))
$module = $1;
if ($module =~ /^lib.*\.a$/)
{
($implib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
($staticlib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
}
else
{
@ -71,6 +73,16 @@ foreach my $i (split(/\s/,$makefiles))
}
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;
@ -128,7 +140,7 @@ foreach my $dir (sort values %directories)
}
printf NEWMAKE "\n\nSUBDIRS = \\\n\t\$(BASEDIRS)";
foreach my $dir (sort (keys %special_dlls, values %implib_dirs))
foreach my $dir (sort (keys %special_dlls, values %staticlib_dirs))
{
printf NEWMAKE " \\\n\t%s", $dir;
}
@ -155,7 +167,7 @@ foreach my $mod (sort keys %directories)
$targets16{sprintf("%s.so",$i)} = 1;
}
}
foreach my $mod (sort keys %implib_dirs) { $targets{$mod} = 1; }
foreach my $mod (sort keys %staticlib_dirs) { $targets{$mod} = 1; }
print NEWMAKE <<EOF;
@ -218,51 +230,68 @@ foreach my $mod (sort keys %directories)
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s.so \$@\n\n", $mod;
}
}
foreach my $mod (sort keys %implib_dirs)
foreach my $mod (sort keys %staticlib_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;
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;
}
################################################################
# output the import libraries rules
my @implibs = grep /\.dll$/, keys %directories;
push @implibs, "winspool.drv";
print NEWMAKE "\n# Import libraries\n\n";
print NEWMAKE "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
print NEWMAKE "\n# Import libraries\n\nIMPORT_LIBS =";
foreach my $mod (sort @implibs)
my @lib_symlinks = ("ntdll.dll");
foreach my $mod (sort keys %importlibs)
{
my $def = $mod;
$def =~ s/\.(dll|drv)$//;
printf NEWMAKE " \\\n\tlib%s.\$(IMPLIBEXT)", $def;
my $dir = $directories{$mod};
my $lib = $importlibs{$mod};
if ($lib ne "lib" . $dir) { push @lib_symlinks, $mod; }
}
foreach my $mod (sort keys %implib_dirs)
print NEWMAKE "IMPORT_SYMLINKS =";
foreach my $mod (sort @lib_symlinks)
{
printf NEWMAKE " \\\n\t%s.\$(IMPLIBEXT)", $importlibs{$mod};
}
foreach my $mod (sort keys %staticlib_dirs)
{
printf NEWMAKE " \\\n\t%s", $mod;
}
print NEWMAKE "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
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 @implibs)
foreach my $mod (sort keys %importlibs)
{
my $dir = $directories{$mod};
my $def = $mod;
my $lib = $importlibs{$mod};
my $spec = $mod;
$spec =~ s/\.dll$//;
$def =~ s/\.(dll|drv)$//;
printf NEWMAKE "lib%s.def: %s/lib%s.def\n", $def, $dir, $spec;
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/lib%s.def \$@\n", $dir, $spec;
printf NEWMAKE "lib%s.a: %s/lib%s.a\n", $def, $dir, $spec;
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/lib%s.a \$@\n", $dir, $spec;
printf NEWMAKE "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $spec, $dir, $spec;
printf NEWMAKE "\t\$(WINEBUILD) -w --def -o \$@ --export \$(SRCDIR)/%s/%s.spec\n", $dir, $spec;
printf NEWMAKE "%s/lib%s.a: %s/lib%s.def\n", $dir, $spec, $dir, $spec;
printf NEWMAKE "\t\$(DLLTOOL) -k -l \$@ -d %s/lib%s.def\n\n", $dir, $spec;
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__): \$(IMPORT_LIBS)
@ -277,9 +306,9 @@ foreach my $mod (sort keys %directories)
{
printf NEWMAKE "%s/%s.so: %s\n", $directories{$mod}, $mod, $directories{$mod};
}
foreach my $mod (sort keys %implib_dirs)
foreach my $mod (sort keys %staticlib_dirs)
{
printf NEWMAKE "%s/%s: %s\n", $implib_dirs{$mod}, $mod, $implib_dirs{$mod};
printf NEWMAKE "%s/%s: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
}
################################################################
@ -316,7 +345,7 @@ uninstall::
-rmdir \$(dlldir)
clean::
\$(RM) \$(IMPORT_LIBS)
\$(RM) \$(IMPORT_SYMLINKS)
check test:: \$(BUILDSUBDIRS:%=%/__test__)

View File

@ -15,6 +15,7 @@ DEFS = $(DLLDEFS) $(EXTRADEFS)
ALL_OBJS = $(OBJS) $(MODULE).dbg.o
ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
ALL_LIBS = $(ALL_IMPORTS:%=-l%) $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
DLL_LDPATH = -L$(DLLDIR) $(ALL_IMPORTS:%=-L$(DLLDIR)/%)
BASEMODULE = $(MODULE:.exe=)
RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR)
@ -25,7 +26,7 @@ all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
# Rules for .so main module
$(MODULE).so: $(ALL_OBJS) $(RC_SRCS:.rc=.res) Makefile.in
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(ALL_OBJS) $(RC_SRCS:.rc=.res) -o $@ -L$(DLLDIR) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(ALL_OBJS) $(RC_SRCS:.rc=.res) -o $@ $(DLL_LDPATH) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
$(BASEMODULE): $(WINEWRAPPER)
$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@

View File

@ -19,10 +19,10 @@ C_SRCS = \
all: aviinfo.exe$(DLLEXT) aviplay.exe$(DLLEXT) icinfo.exe$(DLLEXT) aviinfo$(EXEEXT) aviplay$(EXEEXT) icinfo$(EXEEXT)
aviinfo.exe.so: aviinfo.o
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ aviinfo.o -L$(DLLDIR) -lavifil32 -lkernel32 $(ALL_LIBS)
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ aviinfo.o -L$(DLLDIR)/avifil32 -L$(DLLDIR) -lavifil32 -lkernel32 $(ALL_LIBS)
aviplay.exe.so: aviplay.o
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ aviplay.o -L$(DLLDIR) -lavifil32 -lddraw -lkernel32 $(ALL_LIBS)
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ aviplay.o -L$(DLLDIR)/avifil32 -L$(DLLDIR)/ddraw -L$(DLLDIR) -lavifil32 -lddraw -lkernel32 $(ALL_LIBS)
icinfo.exe.so: icinfo.o
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ icinfo.o -L$(DLLDIR) -lmsvfw32 -lkernel32 $(ALL_LIBS)