Commit 49f88527 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Parse the entire top-level makefile.

It's only done once so there are no longer any performance concerns. Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent ce231568
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
# sgmlpages: compile sgml source for the Wine API Guide # sgmlpages: compile sgml source for the Wine API Guide
# xmlpages: compile xml 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 # The following variable definitions are copied into all makefiles
prefix = @prefix@ prefix = @prefix@
...@@ -100,8 +99,6 @@ ALL_TEST_RESOURCES = @ALL_TEST_RESOURCES@ ...@@ -100,8 +99,6 @@ ALL_TEST_RESOURCES = @ALL_TEST_RESOURCES@
@ALL_VARS_RULES@ @ALL_VARS_RULES@
@SET_MAKE@ @SET_MAKE@
# End of common header
all: wine all: wine
@echo "Wine build complete." @echo "Wine build complete."
......
...@@ -182,6 +182,7 @@ struct makefile ...@@ -182,6 +182,7 @@ struct makefile
static struct makefile *top_makefile; static struct makefile *top_makefile;
static const char separator[] = "### Dependencies";
static const char *output_makefile_name = "Makefile"; static const char *output_makefile_name = "Makefile";
static const char *input_file_name; static const char *input_file_name;
static const char *output_file_name; static const char *output_file_name;
...@@ -1685,7 +1686,7 @@ static int set_make_variable( struct strarray *array, const char *assignment ) ...@@ -1685,7 +1686,7 @@ static int set_make_variable( struct strarray *array, const char *assignment )
/******************************************************************* /*******************************************************************
* parse_makefile * parse_makefile
*/ */
static struct makefile *parse_makefile( const char *path, const char *separator ) static struct makefile *parse_makefile( const char *path )
{ {
char *buffer; char *buffer;
FILE *file; FILE *file;
...@@ -1702,7 +1703,7 @@ static struct makefile *parse_makefile( const char *path, const char *separator ...@@ -1702,7 +1703,7 @@ static struct makefile *parse_makefile( const char *path, const char *separator
file = open_input_makefile( make ); file = open_input_makefile( make );
while ((buffer = get_line( file ))) 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 */ if (*buffer == '\t') continue; /* command */
while (isspace( *buffer )) buffer++; while (isspace( *buffer )) buffer++;
if (*buffer == '#') continue; /* comment */ if (*buffer == '#') continue; /* comment */
...@@ -3211,7 +3212,6 @@ static void output_top_variables( const struct makefile *make ) ...@@ -3211,7 +3212,6 @@ static void output_top_variables( const struct makefile *make )
*/ */
static void output_dependencies( const struct makefile *make ) static void output_dependencies( const struct makefile *make )
{ {
static const char separator[] = "### Dependencies";
struct strarray targets, ignore_files = empty_strarray; struct strarray targets, ignore_files = empty_strarray;
char buffer[1024]; char buffer[1024];
FILE *src_file; FILE *src_file;
...@@ -3449,7 +3449,7 @@ int main( int argc, char *argv[] ) ...@@ -3449,7 +3449,7 @@ int main( int argc, char *argv[] )
for (i = 0; i < HASH_SIZE; i++) list_init( &files[i] ); 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" ); linguas = get_expanded_make_var_array( top_makefile, "LINGUAS" );
target_flags = get_expanded_make_var_array( top_makefile, "TARGETFLAGS" ); target_flags = get_expanded_make_var_array( top_makefile, "TARGETFLAGS" );
...@@ -3485,7 +3485,7 @@ int main( int argc, char *argv[] ) ...@@ -3485,7 +3485,7 @@ int main( int argc, char *argv[] )
top_makefile->submakes = xmalloc( top_makefile->subdirs.count * sizeof(*top_makefile->submakes) ); top_makefile->submakes = xmalloc( top_makefile->subdirs.count * sizeof(*top_makefile->submakes) );
for (i = 0; i < top_makefile->subdirs.count; i++) 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 ); load_sources( top_makefile );
for (i = 0; i < top_makefile->subdirs.count; i++) for (i = 0; i < top_makefile->subdirs.count; i++)
...@@ -3500,7 +3500,7 @@ int main( int argc, char *argv[] ) ...@@ -3500,7 +3500,7 @@ int main( int argc, char *argv[] )
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
struct makefile *make = parse_makefile( argv[i], NULL ); struct makefile *make = parse_makefile( argv[i] );
load_sources( make ); load_sources( make );
output_dependencies( make ); output_dependencies( make );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment