makefiles: Add support for specifying extra dependencies in libraries and programs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2015-11-13 14:17:18 +09:00
parent 3042f720d8
commit d1578a61ab
3 changed files with 34 additions and 10 deletions

8
configure vendored
View File

@ -7989,8 +7989,7 @@ IMPORTLIB = libwine.a
INSTALL_LIB = libwine.dll
INSTALL_DEV = libwine.a
libwine_LDFLAGS = -shared \$(srcdir)/wine.def
libwine.dll: \$(srcdir)/wine.def
libwine_DEPS = wine.def
"
;;
@ -8239,7 +8238,7 @@ libwine_LDFLAGS = -dynamiclib -install_name @rpath/libwine.$libwine_soversion.dy
as_fn_append LOADER_RULES "
${wine_binary}_OBJS = main.o
${wine_binary}_LDFLAGS = $LDEXECFLAGS -lwine \$(PTHREAD_LIBS)
$wine_binary $wine_binary-installed: wine_info.plist
${wine_binary}_DEPS = wine_info.plist
"
;;
@ -8755,8 +8754,7 @@ SHAREDLIB = libwine.so.$libwine_version
INSTALL_LIB = libwine.so.$libwine_version libwine.so.$libwine_soversion
INSTALL_DEV = libwine.so
libwine_LDFLAGS = $shared_ldflags
libwine.so.$libwine_version: \$(srcdir)/wine.map
libwine_DEPS = wine.map
"

View File

@ -723,8 +723,7 @@ IMPORTLIB = libwine.a
INSTALL_LIB = libwine.dll
INSTALL_DEV = libwine.a
libwine_LDFLAGS = -shared \$(srcdir)/wine.def
libwine.dll: \$(srcdir)/wine.def
libwine_DEPS = wine.def
"])
;;
@ -853,7 +852,7 @@ libwine_LDFLAGS = -dynamiclib -install_name @rpath/libwine.$libwine_soversion.dy
AS_VAR_APPEND([LOADER_RULES],["
${wine_binary}_OBJS = main.o
${wine_binary}_LDFLAGS = $LDEXECFLAGS -lwine \$(PTHREAD_LIBS)
$wine_binary $wine_binary-installed: wine_info.plist
${wine_binary}_DEPS = wine_info.plist
"])
;;
@ -955,8 +954,7 @@ SHAREDLIB = libwine.so.$libwine_version
INSTALL_LIB = libwine.so.$libwine_version libwine.so.$libwine_soversion
INSTALL_DEV = libwine.so
libwine_LDFLAGS = $shared_ldflags
libwine.so.$libwine_version: \$(srcdir)/wine.map
libwine_DEPS = wine.map
"])
AS_VAR_APPEND([LOADER_RULES],["

View File

@ -1865,6 +1865,28 @@ static void get_dependencies( struct strarray *deps, struct incl_file *file, str
}
/*******************************************************************
* get_local_dependencies
*
* Get the local dependencies of a given target.
*/
static struct strarray get_local_dependencies( const struct makefile *make, const char *name,
struct strarray targets )
{
unsigned int i;
struct strarray deps = get_expanded_make_var_array( make, file_local_var( name, "DEPS" ));
for (i = 0; i < deps.count; i++)
{
if (strarray_exists( &targets, deps.str[i] ))
deps.str[i] = obj_dir_path( make, deps.str[i] );
else
deps.str[i] = src_dir_path( make, deps.str[i] );
}
return deps;
}
/*******************************************************************
* add_install_rule
*/
@ -2018,6 +2040,7 @@ static struct strarray output_sources( const struct makefile *make, struct strar
struct strarray mo_files = empty_strarray;
struct strarray mc_files = empty_strarray;
struct strarray ok_files = empty_strarray;
struct strarray in_files = empty_strarray;
struct strarray dlldata_files = empty_strarray;
struct strarray c2man_files = empty_strarray;
struct strarray implib_objs = empty_strarray;
@ -2224,6 +2247,7 @@ static struct strarray output_sources( const struct makefile *make, struct strar
free( dest );
free( dir );
}
strarray_add( &in_files, xstrdup(obj) );
strarray_add( &all_targets, xstrdup(obj) );
output( "%s: %s\n", obj_dir_path( make, obj ), source->filename );
output( "\t$(SED_CMD) %s >$@ || (rm -f $@ && false)\n", source->filename );
@ -2595,6 +2619,7 @@ static struct strarray output_sources( const struct makefile *make, struct strar
output( "%s:", obj_dir_path( make, make->sharedlib ));
output_filenames_obj_dir( make, object_files );
output_filenames( get_local_dependencies( make, basename, in_files ));
output( "\n" );
output( "\t$(CC) -o $@" );
output_filenames_obj_dir( make, object_files );
@ -2719,6 +2744,7 @@ static struct strarray output_sources( const struct makefile *make, struct strar
char *program_installed = NULL;
char *program = strmake( "%s%s", make->programs.str[i], exe_ext );
struct strarray all_libs = empty_strarray;
struct strarray deps = get_local_dependencies( make, make->programs.str[i], in_files );
struct strarray objs = get_expanded_make_var_array( make,
file_local_var( make->programs.str[i], "OBJS" ));
struct strarray symlinks = get_expanded_make_var_array( make,
@ -2727,6 +2753,7 @@ static struct strarray output_sources( const struct makefile *make, struct strar
if (!objs.count) objs = object_files;
output( "%s:", obj_dir_path( make, program ) );
output_filenames_obj_dir( make, objs );
output_filenames( deps );
output( "\n" );
output( "\t$(CC) -o $@" );
output_filenames_obj_dir( make, objs );
@ -2748,6 +2775,7 @@ static struct strarray output_sources( const struct makefile *make, struct strar
output( "\n" );
output( "%s:", obj_dir_path( make, program_installed ) );
output_filenames_obj_dir( make, objs );
output_filenames( deps );
output( "\n" );
output( "\t$(CC) -o $@" );
output_filenames_obj_dir( make, objs );