Alexandre Julliard : makefiles: Parse the entire top-level makefile.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 25 10:56:04 CST 2016


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Feb 25 17:08:12 2016 +0900

makefiles: Parse the entire top-level makefile.

It's only done once so there are no longer any performance concerns.

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

---

 Makefile.in     |  3 ---
 tools/makedep.c | 12 ++++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index b78f43b..91b134f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,7 +18,6 @@
 # sgmlpages:       compile sgml source for the Wine API Guide
 # xmlpages:        compile xml source for the Wine API Guide
 
-# Start of common header
 # The following variable definitions are copied into all makefiles
 
 prefix          = @prefix@
@@ -100,8 +99,6 @@ ALL_TEST_RESOURCES  = @ALL_TEST_RESOURCES@
 @ALL_VARS_RULES@
 @SET_MAKE@
 
-# End of common header
-
 all: wine
 	@echo "Wine build complete."
 
diff --git a/tools/makedep.c b/tools/makedep.c
index 4264b5e..70dd753 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -182,6 +182,7 @@ struct makefile
 
 static struct makefile *top_makefile;
 
+static const char separator[] = "### Dependencies";
 static const char *output_makefile_name = "Makefile";
 static const char *input_file_name;
 static const char *output_file_name;
@@ -1685,7 +1686,7 @@ static int set_make_variable( struct strarray *array, const char *assignment )
 /*******************************************************************
  *         parse_makefile
  */
-static struct makefile *parse_makefile( const char *path, const char *separator )
+static struct makefile *parse_makefile( const char *path )
 {
     char *buffer;
     FILE *file;
@@ -1702,7 +1703,7 @@ static struct makefile *parse_makefile( const char *path, const char *separator
     file = open_input_makefile( make );
     while ((buffer = get_line( file )))
     {
-        if (separator && !strncmp( buffer, separator, strlen(separator) )) break;
+        if (!strncmp( buffer, separator, strlen(separator) )) break;
         if (*buffer == '\t') continue;  /* command */
         while (isspace( *buffer )) buffer++;
         if (*buffer == '#') continue;  /* comment */
@@ -3211,7 +3212,6 @@ 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, ignore_files = empty_strarray;
     char buffer[1024];
     FILE *src_file;
@@ -3449,7 +3449,7 @@ int main( int argc, char *argv[] )
 
     for (i = 0; i < HASH_SIZE; i++) list_init( &files[i] );
 
-    top_makefile = parse_makefile( NULL, "# End of common header" );
+    top_makefile = parse_makefile( NULL );
 
     linguas      = get_expanded_make_var_array( top_makefile, "LINGUAS" );
     target_flags = get_expanded_make_var_array( top_makefile, "TARGETFLAGS" );
@@ -3485,7 +3485,7 @@ int main( int argc, char *argv[] )
         top_makefile->submakes = xmalloc( top_makefile->subdirs.count * sizeof(*top_makefile->submakes) );
 
         for (i = 0; i < top_makefile->subdirs.count; i++)
-            top_makefile->submakes[i] = parse_makefile( top_makefile->subdirs.str[i], NULL );
+            top_makefile->submakes[i] = parse_makefile( top_makefile->subdirs.str[i] );
 
         load_sources( top_makefile );
         for (i = 0; i < top_makefile->subdirs.count; i++)
@@ -3500,7 +3500,7 @@ int main( int argc, char *argv[] )
 
     for (i = 1; i < argc; i++)
     {
-        struct makefile *make = parse_makefile( argv[i], NULL );
+        struct makefile *make = parse_makefile( argv[i] );
         load_sources( make );
         output_dependencies( make );
     }




More information about the wine-cvs mailing list