makefiles: Build import libraries that contain object files as static libraries.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-03-25 15:31:54 +09:00
parent 255b90c64c
commit 27528e5498
4 changed files with 19 additions and 59 deletions

25
aclocal.m4 vendored
View File

@ -395,29 +395,18 @@ $ac_dir/uninstall::
if wine_fn_has_flag staticimplib
then
wine_fn_append_rule \
"__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT
$ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps
$ac_file.def: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD)
\$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$[@] --export $srcdir/$ac_dir/$ac_name.spec
$ac_file.$STATIC_IMPLIBEXT: dummy
@cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT
"__builddeps__: $ac_file.a
$ac_file.a $ac_file.cross.a: $ac_deps
$ac_file.a: dummy
@cd $ac_dir && \$(MAKE) lib$ac_implib.a
.PHONY: $ac_dir/install-dev $ac_dir/uninstall
$ac_dir/install-dev:: $ac_file.$IMPLIBEXT
\$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
$ac_dir/install-dev:: $ac_file.a
\$(INSTALL_DATA) $ac_file.a \$(DESTDIR)\$(dlldir)/lib$ac_implib.a
$ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.a
install install-dev:: $ac_dir/install-dev
__uninstall__: $ac_dir/uninstall"
if test "$IMPLIBEXT" != "$STATIC_IMPLIBEXT"
then
wine_fn_append_rule \
"$ac_dir/install-dev:: $ac_file.$STATIC_IMPLIBEXT __builddeps__
\$(INSTALL_DATA) $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT
$ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
fi
if test -n "$CROSSTARGET" -a -z "$ac_implibflags"
then
wine_fn_append_rule \

27
configure vendored
View File

@ -7184,7 +7184,6 @@ LDEXECFLAGS=""
LIBEXT="so"
DLLEXT=".so"
IMPLIBEXT="def"
STATIC_IMPLIBEXT="def.a"
# Extract the first word of "ldd", so it can be a program name with args.
set dummy ldd; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@ -7622,29 +7621,18 @@ fi
if wine_fn_has_flag staticimplib
then
wine_fn_append_rule \
"__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT
$ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps
$ac_file.def: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD)
\$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$@ --export $srcdir/$ac_dir/$ac_name.spec
$ac_file.$STATIC_IMPLIBEXT: dummy
@cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT
"__builddeps__: $ac_file.a
$ac_file.a $ac_file.cross.a: $ac_deps
$ac_file.a: dummy
@cd $ac_dir && \$(MAKE) lib$ac_implib.a
.PHONY: $ac_dir/install-dev $ac_dir/uninstall
$ac_dir/install-dev:: $ac_file.$IMPLIBEXT
\$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
$ac_dir/install-dev:: $ac_file.a
\$(INSTALL_DATA) $ac_file.a \$(DESTDIR)\$(dlldir)/lib$ac_implib.a
$ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.a
install install-dev:: $ac_dir/install-dev
__uninstall__: $ac_dir/uninstall"
if test "$IMPLIBEXT" != "$STATIC_IMPLIBEXT"
then
wine_fn_append_rule \
"$ac_dir/install-dev:: $ac_file.$STATIC_IMPLIBEXT __builddeps__
\$(INSTALL_DATA) $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT
$ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
fi
if test -n "$CROSSTARGET" -a -z "$ac_implibflags"
then
wine_fn_append_rule \
@ -7921,7 +7909,6 @@ fi
LIBEXT="dll"
DLLEXT=""
IMPLIBEXT="a"
STATIC_IMPLIBEXT="a"
enable_iphlpapi=${enable_iphlpapi:-no}
enable_kernel32=${enable_kernel32:-no}
enable_msvcrt=${enable_msvcrt:-no}

View File

@ -676,7 +676,6 @@ AC_SUBST(LDEXECFLAGS,"")
LIBEXT="so"
DLLEXT=".so"
IMPLIBEXT="def"
STATIC_IMPLIBEXT="def.a"
WINE_PATH_SONAME_TOOLS
WINE_CONFIG_HELPERS
@ -691,7 +690,6 @@ case $host_os in
LIBEXT="dll"
DLLEXT=""
IMPLIBEXT="a"
STATIC_IMPLIBEXT="a"
dnl Disable modules that can't be used on Windows
enable_iphlpapi=${enable_iphlpapi:-no}
enable_kernel32=${enable_kernel32:-no}

View File

@ -1810,7 +1810,7 @@ static void add_generated_sources( struct makefile *make )
if (source->file->flags & FLAG_C_IMPLIB)
{
if (!make->staticimplib && make->importlib && *dll_ext)
make->staticimplib = strmake( "lib%s.def.a", make->importlib );
make->staticimplib = strmake( "lib%s.a", make->importlib );
}
if (strendswith( source->name, ".po" ))
{
@ -2004,9 +2004,10 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra
const char *dir = top_obj_dir_path( make, submake->base_dir );
const char *ext = cross ? "cross.a" : *dll_ext ? "def" : "a";
strarray_add( deps, strmake( "%s/lib%s.%s", dir, name, ext ));
if (!cross && submake->staticimplib)
strarray_add( deps, strmake( "%s/%s", dir, submake->staticimplib ));
lib = base_dir_path( submake, submake->staticimplib );
else
strarray_add( deps, strmake( "%s/lib%s.%s", dir, name, ext ));
break;
}
@ -2704,7 +2705,7 @@ static struct strarray output_sources( const struct makefile *make )
if (spec_file && make->importlib)
{
char *importlib_path = obj_dir_path( make, strmake( "lib%s", make->importlib ));
if (*dll_ext)
if (*dll_ext && !implib_objs.count)
{
strarray_add( &clean_files, strmake( "lib%s.def", make->importlib ));
output( "%s.def: %s %s\n", importlib_path, tools_path( make, "winebuild" ), spec_file );
@ -2715,21 +2716,6 @@ static struct strarray output_sources( const struct makefile *make )
add_install_rule( make, install_rules, make->importlib,
strmake( "lib%s.def", make->importlib ),
strmake( "d$(dlldir)/lib%s.def", make->importlib ));
if (implib_objs.count)
{
strarray_add( &clean_files, strmake( "lib%s.def.a", make->importlib ));
output( "%s.def.a:", importlib_path );
output_filenames_obj_dir( make, implib_objs );
output( "\n" );
output( "\trm -f $@\n" );
output( "\t$(AR) $(ARFLAGS) $@" );
output_filenames_obj_dir( make, implib_objs );
output( "\n" );
output( "\t$(RANLIB) $@\n" );
add_install_rule( make, install_rules, make->importlib,
strmake( "lib%s.def.a", make->importlib ),
strmake( "d$(dlldir)/lib%s.def.a", make->importlib ));
}
}
else
{