[PATCH v2 4/6] makedep: Search for imports for all the targets.

Paul Gofman pgofman at codeweavers.com
Thu Jun 11 09:47:44 CDT 2020


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
 tools/makedep.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tools/makedep.c b/tools/makedep.c
index 536d2263e35..c62a662b214 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -177,8 +177,10 @@ struct makefile
     struct strarray programs;
     struct strarray scripts;
     struct strarray imports;
+    struct strarray extra_target_imports;
     struct strarray subdirs;
     struct strarray delayimports;
+    struct strarray extra_target_delayimports;
     struct strarray extradllflags;
     struct strarray install_lib;
     struct strarray install_dev;
@@ -1789,6 +1791,28 @@ static struct strarray get_expanded_make_var_array( const struct makefile *make,
     return ret;
 }
 
+static struct strarray get_expanded_make_multiple_var_array( const struct makefile *make, const char *name_suffix )
+{
+    struct strarray ret = empty_strarray;
+    unsigned int i, name_suffix_len;
+    char *value, *token;
+
+    name_suffix_len = strlen( name_suffix );
+
+    for (i = 0; i < make->vars.count / 2; ++i)
+    {
+        const char *str = make->vars.str[i * 2];
+        unsigned int len = strlen( str );
+
+        if (len > name_suffix_len && !strcmp( str + len - name_suffix_len, name_suffix )
+                && (value = get_expanded_make_variable( make, str )))
+        {
+            for (token = strtok( value, " \t" ); token; token = strtok( NULL, " \t" ))
+                strarray_add_uniq( &ret, token );
+        }
+    }
+    return ret;
+}
 
 /*******************************************************************
  *         get_expanded_file_local_var
@@ -4271,7 +4295,11 @@ static void load_sources( struct makefile *make )
     make->programs      = get_expanded_make_var_array( make, "PROGRAMS" );
     make->scripts       = get_expanded_make_var_array( make, "SCRIPTS" );
     make->imports       = get_expanded_make_var_array( make, "IMPORTS" );
+    make->extra_target_imports
+                        = get_expanded_make_multiple_var_array( make, "_IMPORTS" );
     make->delayimports  = get_expanded_make_var_array( make, "DELAYIMPORTS" );
+    make->extra_target_delayimports
+                        = get_expanded_make_multiple_var_array( make, "_DELAYIMPORTS" );
     make->extradllflags = get_expanded_make_var_array( make, "EXTRADLLFLAGS" );
     make->install_lib   = get_expanded_make_var_array( make, "INSTALL_LIB" );
     make->install_dev   = get_expanded_make_var_array( make, "INSTALL_DEV" );
@@ -4363,6 +4391,10 @@ static void load_sources( struct makefile *make )
     {
         for (i = 0; i < make->imports.count; i++)
             strarray_add_uniq( &cross_import_libs, make->imports.str[i] );
+
+        for (i = 0; i < make->extra_target_imports.count; i++)
+            strarray_add_uniq( &cross_import_libs, make->extra_target_imports.str[i] );
+
         if (make->is_win16) strarray_add_uniq( &cross_import_libs, "kernel" );
         strarray_add_uniq( &cross_import_libs, "winecrt0" );
         strarray_add_uniq( &cross_import_libs, "kernel32" );
@@ -4370,8 +4402,13 @@ static void load_sources( struct makefile *make )
     }
 
     if (!*dll_ext || make->is_cross)
+    {
+        for (i = 0; i < make->extra_target_delayimports.count; i++)
+            strarray_add_uniq( &delay_import_libs, get_base_name( make->extra_target_delayimports.str[i] ));
+
         for (i = 0; i < make->delayimports.count; i++)
             strarray_add_uniq( &delay_import_libs, get_base_name( make->delayimports.str[i] ));
+    }
 }
 
 
-- 
2.26.2




More information about the wine-devel mailing list