Commit eda25a58 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Link with the full library name for Unix library imports.

parent 0f62381f
...@@ -2112,6 +2112,18 @@ static const char *get_static_lib( const struct makefile *make, const char *name ...@@ -2112,6 +2112,18 @@ static const char *get_static_lib( const struct makefile *make, const char *name
/******************************************************************* /*******************************************************************
* get_native_unix_lib
*/
static const char *get_native_unix_lib( const struct makefile *make, const char *name )
{
if (!make->unixlib) return NULL;
if (strncmp( make->unixlib, name, strlen(name) )) return NULL;
if (make->unixlib[strlen(name)] != '.') return NULL;
return obj_dir_path( make, make->unixlib );
}
/*******************************************************************
* get_parent_makefile * get_parent_makefile
*/ */
static struct makefile *get_parent_makefile( struct makefile *make ) static struct makefile *get_parent_makefile( struct makefile *make )
...@@ -2162,13 +2174,15 @@ static int needs_implib_symlink( const struct makefile *make ) ...@@ -2162,13 +2174,15 @@ static int needs_implib_symlink( const struct makefile *make )
/******************************************************************* /*******************************************************************
* add_unix_libraries * add_unix_libraries
*/ */
static struct strarray add_unix_libraries( const struct makefile *make, struct strarray *deps ) static struct strarray add_unix_libraries( const struct makefile *make, struct strarray *deps,
int native_unix )
{ {
struct strarray ret = empty_strarray; struct strarray ret = empty_strarray;
struct strarray all_libs = empty_strarray; struct strarray all_libs = empty_strarray;
unsigned int i, j; unsigned int i, j;
strarray_add( &all_libs, "-lwine_port" ); strarray_add( &all_libs, "-lwine_port" );
if (native_unix && strcmp( make->module, "ntdll.dll" )) strarray_add( &all_libs, "-lntdll" );
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" )); strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, libs ); strarray_addall( &all_libs, libs );
...@@ -2182,6 +2196,9 @@ static struct strarray add_unix_libraries( const struct makefile *make, struct s ...@@ -2182,6 +2196,9 @@ static struct strarray add_unix_libraries( const struct makefile *make, struct s
for (j = 0; j < subdirs.count; j++) for (j = 0; j < subdirs.count; j++)
if ((lib = get_static_lib( submakes[j], name ))) break; if ((lib = get_static_lib( submakes[j], name ))) break;
if (!lib && native_unix)
for (j = 0; j < subdirs.count; j++)
if ((lib = get_native_unix_lib( submakes[j], name ))) break;
} }
if (lib) if (lib)
...@@ -3325,7 +3342,7 @@ static void output_module( struct makefile *make ) ...@@ -3325,7 +3342,7 @@ static void output_module( struct makefile *make )
} }
else if (*dll_ext) else if (*dll_ext)
{ {
if (!make->use_msvcrt) strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs )); if (!make->use_msvcrt) strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs, 0 ));
for (i = 0; i < make->delayimports.count; i++) for (i = 0; i < make->delayimports.count; i++)
strarray_add( &all_libs, strmake( "-Wl,-delayload,%s%s", make->delayimports.str[i], strarray_add( &all_libs, strmake( "-Wl,-delayload,%s%s", make->delayimports.str[i],
strchr( make->delayimports.str[i], '.' ) ? "" : ".dll" )); strchr( make->delayimports.str[i], '.' ) ? "" : ".dll" ));
...@@ -3339,7 +3356,7 @@ static void output_module( struct makefile *make ) ...@@ -3339,7 +3356,7 @@ static void output_module( struct makefile *make )
} }
else else
{ {
strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs )); strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs, 0 ));
strarray_add( &make->all_targets, make->module ); strarray_add( &make->all_targets, make->module );
add_install_rule( make, make->module, make->module, add_install_rule( make, make->module, make->module,
strmake( "p$(%s)/%s", spec_file ? "dlldir" : "bindir", make->module )); strmake( "p$(%s)/%s", spec_file ? "dlldir" : "bindir", make->module ));
...@@ -3376,15 +3393,7 @@ static void output_module( struct makefile *make ) ...@@ -3376,15 +3393,7 @@ static void output_module( struct makefile *make )
struct strarray extra_libs = get_expanded_make_var_array( make, "EXTRALIBS" ); struct strarray extra_libs = get_expanded_make_var_array( make, "EXTRALIBS" );
int native_unix_lib = strarray_exists( &extra_libs, "-Wl,--subsystem,unixlib" ); int native_unix_lib = strarray_exists( &extra_libs, "-Wl,--subsystem,unixlib" );
if (native_unix_lib) if (!native_unix_lib)
{
if (strcmp( make->module, "ntdll.dll" ))
{
strarray_add( &unix_libs, "-lntdll" );
strarray_add( &unix_deps, obj_dir_path( top_makefile, "dlls/ntdll/ntdll.so" ));
}
}
else
{ {
struct strarray unix_imports = empty_strarray; struct strarray unix_imports = empty_strarray;
...@@ -3399,7 +3408,7 @@ static void output_module( struct makefile *make ) ...@@ -3399,7 +3408,7 @@ static void output_module( struct makefile *make )
strarray_addall( &unix_libs, add_import_libs( make, &unix_deps, unix_imports, 0, 1 )); strarray_addall( &unix_libs, add_import_libs( make, &unix_deps, unix_imports, 0, 1 ));
} }
strarray_addall( &unix_libs, add_unix_libraries( make, &unix_deps )); strarray_addall( &unix_libs, add_unix_libraries( make, &unix_deps, native_unix_lib ));
strarray_add( &make->all_targets, make->unixlib ); strarray_add( &make->all_targets, make->unixlib );
add_install_rule( make, make->module, make->unixlib, strmake( "p%s/%s", so_dir, make->unixlib )); add_install_rule( make, make->module, make->unixlib, strmake( "p%s/%s", so_dir, make->unixlib ));
...@@ -3546,7 +3555,7 @@ static void output_shared_lib( struct makefile *make ) ...@@ -3546,7 +3555,7 @@ static void output_shared_lib( struct makefile *make )
strarray_addall( &dep_libs, get_local_dependencies( make, basename, make->in_files )); strarray_addall( &dep_libs, get_local_dependencies( make, basename, make->in_files ));
strarray_addall( &all_libs, get_expanded_file_local_var( make, basename, "LDFLAGS" )); strarray_addall( &all_libs, get_expanded_file_local_var( make, basename, "LDFLAGS" ));
strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs )); strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs, 0 ));
output( "%s:", obj_dir_path( make, make->sharedlib )); output( "%s:", obj_dir_path( make, make->sharedlib ));
output_filenames_obj_dir( make, make->object_files ); output_filenames_obj_dir( make, make->object_files );
...@@ -3660,7 +3669,7 @@ static void output_programs( struct makefile *make ) ...@@ -3660,7 +3669,7 @@ static void output_programs( struct makefile *make )
if (!objs.count) objs = make->object_files; if (!objs.count) objs = make->object_files;
if (!strarray_exists( &all_libs, "-nodefaultlibs" )) if (!strarray_exists( &all_libs, "-nodefaultlibs" ))
strarray_addall( &all_libs, add_unix_libraries( make, &deps )); strarray_addall( &all_libs, add_unix_libraries( make, &deps, 0 ));
output( "%s:", obj_dir_path( make, program ) ); output( "%s:", obj_dir_path( make, program ) );
output_filenames_obj_dir( make, objs ); output_filenames_obj_dir( make, objs );
......
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