Alexandre Julliard : makedep: Generate testlist.c directly from the makefile data.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 11 08:22:28 CST 2016


Module: wine
Branch: master
Commit: da9381cea5fe8b1477ddbad7572921302b9202e1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=da9381cea5fe8b1477ddbad7572921302b9202e1

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 11 18:19:18 2016 +0900

makedep: Generate testlist.c directly from the makefile data.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/makedep.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index aa6e161..fd661b2 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -2025,7 +2025,7 @@ static struct strarray output_install_rules( const struct makefile *make, struct
 /*******************************************************************
  *         output_sources
  */
-static struct strarray output_sources( const struct makefile *make, struct strarray *testlist_files )
+static struct strarray output_sources( const struct makefile *make )
 {
     struct incl_file *source;
     unsigned int i, j;
@@ -2736,7 +2736,6 @@ static struct strarray output_sources( const struct makefile *make, struct strar
         strarray_add( &phony_targets, "check" );
         strarray_add( &phony_targets, "test" );
         strarray_add( &phony_targets, "testclean" );
-        *testlist_files = strarray_replace_extension( &ok_files, ".ok", "" );
     }
 
     for (i = 0; i < make->programs.count; i++)
@@ -2947,9 +2946,19 @@ static void rename_temp_file_if_changed( const char *dest )
 /*******************************************************************
  *         output_testlist
  */
-static void output_testlist( const char *dest, struct strarray files )
+static void output_testlist( const struct makefile *make )
 {
-    int i;
+    const char *dest = base_dir_path( make, "testlist.c" );
+    struct strarray files = empty_strarray;
+    struct incl_file *source;
+    unsigned int i;
+
+    LIST_FOR_EACH_ENTRY( source, &make->sources, struct incl_file, entry )
+    {
+        if (source->file->flags & FLAG_GENERATED) continue;
+        if (!strendswith( source->name, ".c" )) continue;
+        strarray_add( &files, replace_extension( source->name, ".c", "" ));
+    }
 
     output_file = create_temp_file( dest );
 
@@ -3022,7 +3031,7 @@ static void output_top_variables( const struct makefile *make )
 static void output_dependencies( const struct makefile *make )
 {
     static const char separator[] = "### Dependencies";
-    struct strarray targets, testlist_files = empty_strarray, ignore_files = empty_strarray;
+    struct strarray targets, ignore_files = empty_strarray;
     char buffer[1024];
     FILE *src_file;
     int found = 0;
@@ -3042,7 +3051,7 @@ static void output_dependencies( const struct makefile *make )
     input_file_name = NULL;
 
     if (!found) output( "\n%s (everything below this line is auto-generated; DO NOT EDIT!!)\n", separator );
-    targets = output_sources( make, &testlist_files );
+    targets = output_sources( make );
 
     fclose( output_file );
     output_file = NULL;
@@ -3050,11 +3059,12 @@ static void output_dependencies( const struct makefile *make )
 
     strarray_add( &ignore_files, ".gitignore" );
     strarray_add( &ignore_files, "Makefile" );
-    if (testlist_files.count) strarray_add( &ignore_files, "testlist.c" );
+    if (make->testdll)
+    {
+        output_testlist( make );
+        strarray_add( &ignore_files, "testlist.c" );
+    }
     strarray_addall( &ignore_files, targets );
-
-    if (testlist_files.count)
-        output_testlist( base_dir_path( make, "testlist.c" ), testlist_files );
     if (!make->src_dir && make->base_dir)
         output_gitignore( base_dir_path( make, ".gitignore" ), ignore_files );
 




More information about the wine-cvs mailing list