Commit 4c208c46 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Generate rules for building libwine.

parent 1db55d44
......@@ -7984,17 +7984,18 @@ fi
;;
esac
libwine_targets="libwine.dll libwine.a"
LIBWINE_RULES="
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
SHAREDLIB = libwine.dll
libwine_LDFLAGS = -shared \$(srcdir)/wine.def
all: libwine.dll libwine.a
EXTRA_TARGETS = libwine.a
all: libwine.a
libwine.a: \$(srcdir)/wine.def
\$(DLLTOOL) -l \$@ -d \$(srcdir)/wine.def
libwine.dll: \$(OBJS) \$(srcdir)/wine.def
\$(CC) -shared \$(srcdir)/wine.def -o \$@ \$(OBJS) $crtlibs \$(EXTRALIBS)
libwine.dll: \$(srcdir)/wine.def
install install-lib:: libwine.dll
\$(INSTALL_DATA) libwine.dll \$(DESTDIR)\$(libdir)/libwine.dll
......@@ -8241,20 +8242,9 @@ fi
fi
libwine_targets="libwine.dylib libwine.$libwine_soversion.dylib libwine.$libwine_version.dylib"
LIBWINE_RULES="
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
all: libwine.dylib
libwine.$libwine_version.dylib: \$(OBJS)
\$(CC) -dynamiclib -install_name @rpath/libwine.$libwine_soversion.dylib -Wl,-rpath,@loader_path/ -compatibility_version $libwine_soversion -current_version $libwine_version \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@
libwine.$libwine_soversion.dylib: libwine.$libwine_version.dylib
\$(RM) \$@ && \$(LN_S) libwine.$libwine_version.dylib \$@
libwine.dylib: libwine.$libwine_soversion.dylib
\$(RM) \$@ && \$(LN_S) libwine.$libwine_soversion.dylib \$@
SHAREDLIB = libwine.$libwine_version.dylib
libwine_LDFLAGS = -dynamiclib -install_name @rpath/libwine.$libwine_soversion.dylib -Wl,-rpath,@loader_path/ -compatibility_version $libwine_soversion -current_version $libwine_version
install install-lib:: libwine.$libwine_version.dylib
\$(INSTALL_PROGRAM) libwine.$libwine_version.dylib \$(DESTDIR)\$(libdir)/libwine.$libwine_version.dylib
......@@ -8418,14 +8408,9 @@ fi
;;
esac
libwine_targets="libwine.so"
LIBWINE_RULES="
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
all: libwine.so
libwine.so: \$(OBJS)
\$(CC) -shared \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@
SHAREDLIB = libwine.so
libwine_LDFLAGS = -shared
install install-lib:: libwine.so
\$(INSTALL_PROGRAM) libwine.so \$(DESTDIR)\$(libdir)/libwine.so
......@@ -8468,7 +8453,7 @@ fi
$as_echo "$ac_cv_c_dll_gnuelf" >&6; }
if test "$ac_cv_c_dll_gnuelf" = "yes"
then
LDSHARED="\$(CC) -shared"
shared_ldflags="-shared"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -shared -Wl,-soname,confest.so.1" >&5
$as_echo_n "checking whether the compiler supports -fPIC -shared -Wl,-soname,confest.so.1... " >&6; }
if ${ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1+:} false; then :
......@@ -8492,7 +8477,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1" >&5
$as_echo "$ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1" >&6; }
if test "x$ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1" = xyes; then :
LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so.$libwine_soversion"
shared_ldflags="-shared -Wl,-soname,libwine.so.$libwine_soversion"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -shared -Wl,-h,confest.so.1" >&5
$as_echo_n "checking whether the compiler supports -fPIC -shared -Wl,-h,confest.so.1... " >&6; }
......@@ -8517,7 +8502,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1" >&5
$as_echo "$ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1" >&6; }
if test "x$ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1" = xyes; then :
LDSHARED="\$(CC) -shared -Wl,-h,libwine.so.$libwine_soversion"
shared_ldflags="-shared -Wl,-h,libwine.so.$libwine_soversion"
fi
fi
......@@ -8545,7 +8530,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map" >&5
$as_echo "$ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map" >&6; }
if test "x$ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map" = xyes; then :
LDSHARED="$LDSHARED -Wl,--version-script=\$(srcdir)/wine.map"
shared_ldflags="$shared_ldflags -Wl,--version-script=\$(srcdir)/wine.map"
fi
rm -f conftest.map
......@@ -8789,23 +8774,14 @@ fi
$as_echo "$ac_cv_c_dll_unixware" >&6; }
if test "$ac_cv_c_dll_unixware" = "yes"
then
LDSHARED="\$(CC) -Wl,-G,-h,libwine.so.$libwine_soversion"
shared_ldflags="-Wl,-G,-h,libwine.so.$libwine_soversion"
fi
fi
libwine_targets="libwine.so libwine.so.$libwine_soversion libwine.so.$libwine_version"
LIBWINE_RULES="
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
all: libwine.so
libwine.so.$libwine_version: \$(OBJS) \$(srcdir)/wine.map
$LDSHARED \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@
SHAREDLIB = libwine.so.$libwine_version
libwine_LDFLAGS = $shared_ldflags
libwine.so.$libwine_soversion: libwine.so.$libwine_version
\$(RM) \$@ && \$(LN_S) libwine.so.$libwine_version \$@
libwine.so: libwine.so.$libwine_soversion
\$(RM) \$@ && \$(LN_S) libwine.so.$libwine_soversion \$@
libwine.so.$libwine_version: \$(srcdir)/wine.map
install install-lib:: libwine.so.$libwine_version
\$(INSTALL_PROGRAM) libwine.so.$libwine_version \$(DESTDIR)\$(libdir)/libwine.so.$libwine_version
......@@ -8835,10 +8811,6 @@ uninstall::
;;
esac
as_fn_append LIBWINE_RULES "
EXTRA_TARGETS = $libwine_targets
"
enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
......
......@@ -717,17 +717,18 @@ case $host_os in
AC_SUBST(SOCKET_LIBS,"-lws2_32") ;;
esac
libwine_targets="libwine.dll libwine.a"
AC_SUBST(LIBWINE_RULES,["
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
SHAREDLIB = libwine.dll
libwine_LDFLAGS = -shared \$(srcdir)/wine.def
all: libwine.dll libwine.a
EXTRA_TARGETS = libwine.a
all: libwine.a
libwine.a: \$(srcdir)/wine.def
\$(DLLTOOL) -l \$@ -d \$(srcdir)/wine.def
libwine.dll: \$(OBJS) \$(srcdir)/wine.def
\$(CC) -shared \$(srcdir)/wine.def -o \$@ \$(OBJS) $crtlibs \$(EXTRALIBS)
libwine.dll: \$(srcdir)/wine.def
install install-lib:: libwine.dll
\$(INSTALL_DATA) libwine.dll \$(DESTDIR)\$(libdir)/libwine.dll
......@@ -855,20 +856,9 @@ uninstall::
AC_MSG_RESULT([[cross-compiling, assuming yes]]))
fi
libwine_targets="libwine.dylib libwine.$libwine_soversion.dylib libwine.$libwine_version.dylib"
AC_SUBST(LIBWINE_RULES,["
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
all: libwine.dylib
libwine.$libwine_version.dylib: \$(OBJS)
\$(CC) -dynamiclib -install_name @rpath/libwine.$libwine_soversion.dylib -Wl,-rpath,@loader_path/ -compatibility_version $libwine_soversion -current_version $libwine_version \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@
libwine.$libwine_soversion.dylib: libwine.$libwine_version.dylib
\$(RM) \$@ && \$(LN_S) libwine.$libwine_version.dylib \$@
libwine.dylib: libwine.$libwine_soversion.dylib
\$(RM) \$@ && \$(LN_S) libwine.$libwine_soversion.dylib \$@
SHAREDLIB = libwine.$libwine_version.dylib
libwine_LDFLAGS = -dynamiclib -install_name @rpath/libwine.$libwine_soversion.dylib -Wl,-rpath,@loader_path/ -compatibility_version $libwine_soversion -current_version $libwine_version
install install-lib:: libwine.$libwine_version.dylib
\$(INSTALL_PROGRAM) libwine.$libwine_version.dylib \$(DESTDIR)\$(libdir)/libwine.$libwine_version.dylib
......@@ -911,14 +901,9 @@ $wine_binary $wine_binary-installed: wine_info.plist
;;
esac
libwine_targets="libwine.so"
AC_SUBST(LIBWINE_RULES,["
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
all: libwine.so
libwine.so: \$(OBJS)
\$(CC) -shared \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@
SHAREDLIB = libwine.so
libwine_LDFLAGS = -shared
install install-lib:: libwine.so
\$(INSTALL_PROGRAM) libwine.so \$(DESTDIR)\$(libdir)/libwine.so
......@@ -941,15 +926,15 @@ ${wine_binary}_LDFLAGS = $LDEXECFLAGS -lwine \$(PTHREAD_LIBS)
ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")])
if test "$ac_cv_c_dll_gnuelf" = "yes"
then
LDSHARED="\$(CC) -shared"
shared_ldflags="-shared"
WINE_TRY_CFLAGS([-fPIC -shared -Wl,-soname,confest.so.1],
[LDSHARED="\$(CC) -shared -Wl,-soname,libwine.so.$libwine_soversion"],
[shared_ldflags="-shared -Wl,-soname,libwine.so.$libwine_soversion"],
[WINE_TRY_CFLAGS([-fPIC -shared -Wl,-h,confest.so.1],
[LDSHARED="\$(CC) -shared -Wl,-h,libwine.so.$libwine_soversion"])])
[shared_ldflags="-shared -Wl,-h,libwine.so.$libwine_soversion"])])
echo '{ global: *; };' >conftest.map
WINE_TRY_CFLAGS([-fPIC -shared -Wl,--version-script=conftest.map],
[LDSHARED="$LDSHARED -Wl,--version-script=\$(srcdir)/wine.map"])
[shared_ldflags="$shared_ldflags -Wl,--version-script=\$(srcdir)/wine.map"])
rm -f conftest.map
WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic],
......@@ -988,23 +973,14 @@ ${wine_binary}_LDFLAGS = $LDEXECFLAGS -lwine \$(PTHREAD_LIBS)
ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")])
if test "$ac_cv_c_dll_unixware" = "yes"
then
LDSHARED="\$(CC) -Wl,-G,-h,libwine.so.$libwine_soversion"
shared_ldflags="-Wl,-G,-h,libwine.so.$libwine_soversion"
fi
fi
libwine_targets="libwine.so libwine.so.$libwine_soversion libwine.so.$libwine_version"
AC_SUBST(LIBWINE_RULES,["
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)
all: libwine.so
libwine.so.$libwine_version: \$(OBJS) \$(srcdir)/wine.map
$LDSHARED \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@
SHAREDLIB = libwine.so.$libwine_version
libwine_LDFLAGS = $shared_ldflags
libwine.so.$libwine_soversion: libwine.so.$libwine_version
\$(RM) \$@ && \$(LN_S) libwine.so.$libwine_version \$@
libwine.so: libwine.so.$libwine_soversion
\$(RM) \$@ && \$(LN_S) libwine.so.$libwine_soversion \$@
libwine.so.$libwine_version: \$(srcdir)/wine.map
install install-lib:: libwine.so.$libwine_version
\$(INSTALL_PROGRAM) libwine.so.$libwine_version \$(DESTDIR)\$(libdir)/libwine.so.$libwine_version
......@@ -1033,10 +1009,6 @@ uninstall::
;;
esac
AS_VAR_APPEND([LIBWINE_RULES],["
EXTRA_TARGETS = $libwine_targets
"])
enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
......
......@@ -169,6 +169,7 @@ struct makefile
const char *parent_dir;
const char *module;
const char *testdll;
const char *sharedlib;
const char *staticlib;
const char *importlib;
int use_msvcrt;
......@@ -1896,6 +1897,42 @@ static const char *get_include_install_path( const char *name )
/*******************************************************************
* get_shared_library_name
*
* Determine possible names for a shared library with a version number.
*/
static struct strarray get_shared_lib_names( const char *libname )
{
struct strarray ret = empty_strarray;
const char *ext, *p;
char *name, *first, *second;
size_t len = 0;
strarray_add( &ret, libname );
for (p = libname; (p = strchr( p, '.' )); p++)
if ((len = strspn( p + 1, "0123456789." ))) break;
if (!len) return ret;
ext = p + 1 + len;
if (*ext && ext[-1] == '.') ext--;
/* keep only the first group of digits */
name = xstrdup( libname );
first = name + (p - libname);
if ((second = strchr( first + 1, '.' )))
{
strcpy( second, ext );
strarray_add( &ret, xstrdup( name ));
}
/* now remove all digits */
strcpy( first, ext );
strarray_add( &ret, name );
return ret;
}
/*******************************************************************
* output_install_rules
*
* Rules are stored as a (file,dest) pair of values.
......@@ -2541,6 +2578,36 @@ static struct strarray output_sources( const struct makefile *make, struct strar
}
}
if (make->sharedlib)
{
char *basename, *p;
struct strarray names = get_shared_lib_names( make->sharedlib );
struct strarray all_libs = empty_strarray;
basename = xstrdup( make->sharedlib );
if ((p = strchr( basename, '.' ))) *p = 0;
strarray_addall( &all_libs, get_expanded_make_var_array( make,
file_local_var( basename, "LDFLAGS" )));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, libs );
output( "%s:", obj_dir_path( make, make->sharedlib ));
output_filenames_obj_dir( make, object_files );
output( "\n" );
output( "\t$(CC) -o $@" );
output_filenames_obj_dir( make, object_files );
output_filenames( all_libs );
output_filename( "$(LDFLAGS)" );
output( "\n" );
for (i = 1; i < names.count; i++)
{
output( "%s: %s\n", obj_dir_path( make, names.str[i] ), obj_dir_path( make, names.str[i-1] ));
output( "\trm -f $@ && $(LN_S) %s $@\n", names.str[i-1] );
}
strarray_addall( &all_targets, names );
}
if (make->testdll)
{
char *testmodule = replace_extension( make->testdll, ".dll", "_test.exe" );
......@@ -2990,6 +3057,7 @@ static void update_makefile( const char *path )
make->parent_dir = get_expanded_make_variable( make, "PARENTSRC" );
make->module = get_expanded_make_variable( make, "MODULE" );
make->testdll = get_expanded_make_variable( make, "TESTDLL" );
make->sharedlib = get_expanded_make_variable( make, "SHAREDLIB" );
make->staticlib = get_expanded_make_variable( make, "STATICLIB" );
make->importlib = get_expanded_make_variable( make, "IMPORTLIB" );
......
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