Alexandre Julliard : makefiles: Add support for specifying extra dependencies in libraries and programs.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Nov 13 08:34:46 CST 2015
Module: wine
Branch: master
Commit: d1578a61abf41c639be76e5a28ba9cf9de97da91
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d1578a61abf41c639be76e5a28ba9cf9de97da91
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Nov 13 14:17:18 2015 +0900
makefiles: Add support for specifying extra dependencies in libraries and programs.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
configure | 8 +++-----
configure.ac | 8 +++-----
tools/makedep.c | 28 ++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/configure b/configure
index 43f6b04..51a6913 100755
--- a/configure
+++ b/configure
@@ -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
"
diff --git a/configure.ac b/configure.ac
index 48268b0..4e9ca89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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],["
diff --git a/tools/makedep.c b/tools/makedep.c
index 023c0ec..75c7d91 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -1866,6 +1866,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
*/
static void add_install_rule( const struct makefile *make, struct strarray *install_rules,
@@ -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 );
More information about the wine-cvs
mailing list