Commit b78ef40a authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Don't copy the source makefile into the sub-directory stub makefiles.

parent d2e7a977
...@@ -1578,7 +1578,7 @@ static FILE *open_input_makefile( const struct makefile *make ) ...@@ -1578,7 +1578,7 @@ static FILE *open_input_makefile( const struct makefile *make )
FILE *ret; FILE *ret;
if (make->obj_dir) if (make->obj_dir)
input_file_name = root_src_dir_path( obj_dir_path( make, strmake( "%s.in", output_makefile_name ))); input_file_name = root_src_dir_path( obj_dir_path( make, "Makefile.in" ));
else else
input_file_name = output_makefile_name; /* always use output name for main Makefile */ input_file_name = output_makefile_name; /* always use output name for main Makefile */
...@@ -3629,7 +3629,7 @@ static void output_subdirs( struct makefile *make ) ...@@ -3629,7 +3629,7 @@ static void output_subdirs( struct makefile *make )
strarray_addall( &all_targets, make->all_targets ); strarray_addall( &all_targets, make->all_targets );
for (i = 0; i < subdirs.count; i++) for (i = 0; i < subdirs.count; i++)
{ {
strarray_add( &makefile_deps, src_dir_path( submakes[i], strmake ( "%s.in", output_makefile_name ))); strarray_add( &makefile_deps, src_dir_path( submakes[i], "Makefile.in" ));
strarray_addall_uniq( &make->phony_targets, submakes[i]->phony_targets ); strarray_addall_uniq( &make->phony_targets, submakes[i]->phony_targets );
strarray_addall_uniq( &make->uninstall_files, submakes[i]->uninstall_files ); strarray_addall_uniq( &make->uninstall_files, submakes[i]->uninstall_files );
strarray_addall_uniq( &dependencies, submakes[i]->dependencies ); strarray_addall_uniq( &dependencies, submakes[i]->dependencies );
...@@ -3998,6 +3998,13 @@ static void output_stub_makefile( struct makefile *make ) ...@@ -3998,6 +3998,13 @@ static void output_stub_makefile( struct makefile *make )
struct strarray targets = empty_strarray; struct strarray targets = empty_strarray;
const char *make_var = strarray_get_value( &top_makefile->vars, "MAKE" ); const char *make_var = strarray_get_value( &top_makefile->vars, "MAKE" );
if (make->obj_dir) create_dir( make->obj_dir );
output_file_name = obj_dir_path( make, "Makefile" );
output_file = create_temp_file( output_file_name );
output( "# Auto-generated stub makefile; all rules forward to the top-level makefile\n\n" );
if (make_var) output( "MAKE = %s\n\n", make_var ); if (make_var) output( "MAKE = %s\n\n", make_var );
output( "all:\n" ); output( "all:\n" );
...@@ -4021,6 +4028,10 @@ static void output_stub_makefile( struct makefile *make ) ...@@ -4021,6 +4028,10 @@ static void output_stub_makefile( struct makefile *make )
output( ".PHONY:" ); output( ".PHONY:" );
output_filenames( targets ); output_filenames( targets );
output( "\n" ); output( "\n" );
fclose( output_file );
output_file = NULL;
rename_temp_file( output_file_name );
} }
...@@ -4059,17 +4070,14 @@ static void output_silent_rules(void) ...@@ -4059,17 +4070,14 @@ static void output_silent_rules(void)
/******************************************************************* /*******************************************************************
* output_dependencies * output_top_makefile
*/ */
static void output_dependencies( struct makefile *make ) static void output_top_makefile( struct makefile *make )
{ {
struct strarray ignore_files = empty_strarray;
char buffer[1024]; char buffer[1024];
FILE *src_file; FILE *src_file;
int i, found = 0; int i, found = 0;
if (make->obj_dir) create_dir( make->obj_dir );
output_file_name = obj_dir_path( make, output_makefile_name ); output_file_name = obj_dir_path( make, output_makefile_name );
output_file = create_temp_file( output_file_name ); output_file = create_temp_file( output_file_name );
...@@ -4085,20 +4093,29 @@ static void output_dependencies( struct makefile *make ) ...@@ -4085,20 +4093,29 @@ static void output_dependencies( struct makefile *make )
if (!found) output( "\n%s (everything below this line is auto-generated; DO NOT EDIT!!)\n", separator ); if (!found) output( "\n%s (everything below this line is auto-generated; DO NOT EDIT!!)\n", separator );
if (make == top_makefile) if (silent_rules) output_silent_rules();
{ for (i = 0; i < subdirs.count; i++) output_sources( submakes[i] );
if (silent_rules) output_silent_rules(); output_sources( make );
for (i = 0; i < subdirs.count; i++) output_sources( submakes[i] );
output_sources( make );
}
else output_stub_makefile( make );
/* disable implicit rules */ /* disable implicit rules */
output( ".SUFFIXES:\n" ); output( ".SUFFIXES:\n" );
fclose( output_file ); fclose( output_file );
output_file = NULL; output_file = NULL;
rename_temp_file( output_file_name ); rename_temp_file( output_file_name );
}
/*******************************************************************
* output_dependencies
*/
static void output_dependencies( struct makefile *make )
{
struct strarray ignore_files = empty_strarray;
if (make->obj_dir) create_dir( make->obj_dir );
if (make == top_makefile) output_top_makefile( make );
else output_stub_makefile( make );
strarray_addall( &ignore_files, make->distclean_files ); strarray_addall( &ignore_files, make->distclean_files );
strarray_addall( &ignore_files, make->clean_files ); strarray_addall( &ignore_files, make->clean_files );
......
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