Commit e0b1e815 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Avoid running config.status when not necessary.

If it doesn't contain substitutions, we can use Makefile.in directly. Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6222e49c
......@@ -225,13 +225,24 @@ wine_fn_has_flag ()
wine_fn_depend_rules ()
{
wine_fn_append_rule \
if wine_fn_has_flag config
then
wine_fn_append_rule \
"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile config.status \$(MAKEDEP)
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) -iMakefile $ac_dir
depend: $ac_dir/depend
.PHONY: $ac_dir/depend
$ac_dir/depend: \$(MAKEDEP) dummy
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir"
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) -iMakefile $ac_dir"
else
wine_fn_append_rule \
"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile \$(MAKEDEP)
\$(MAKEDEP) $ac_dir
depend: $ac_dir/depend
.PHONY: $ac_dir/depend
$ac_dir/depend: \$(MAKEDEP) dummy
\$(MAKEDEP) $ac_dir"
fi
}
wine_fn_pot_rules ()
......
......@@ -7389,13 +7389,24 @@ wine_fn_has_flag ()
wine_fn_depend_rules ()
{
wine_fn_append_rule \
if wine_fn_has_flag config
then
wine_fn_append_rule \
"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile config.status \$(MAKEDEP)
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) -iMakefile $ac_dir
depend: $ac_dir/depend
.PHONY: $ac_dir/depend
$ac_dir/depend: \$(MAKEDEP) dummy
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir"
@./config.status --file $ac_dir/Makefile && \$(MAKEDEP) -iMakefile $ac_dir"
else
wine_fn_append_rule \
"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile \$(MAKEDEP)
\$(MAKEDEP) $ac_dir
depend: $ac_dir/depend
.PHONY: $ac_dir/depend
$ac_dir/depend: \$(MAKEDEP) dummy
\$(MAKEDEP) $ac_dir"
fi
}
wine_fn_pot_rules ()
......@@ -18010,9 +18021,9 @@ wine_fn_config_makefile documentation enable_documentation clean
wine_fn_config_makefile fonts enable_fonts clean,install-lib
wine_fn_config_makefile include enable_include clean,install-dev
wine_fn_config_makefile libs/port enable_libs_port
wine_fn_config_makefile libs/wine enable_libs_wine clean,install-dev,install-lib
wine_fn_config_makefile libs/wine enable_libs_wine clean,config,install-dev,install-lib
wine_fn_config_makefile libs/wpp enable_libs_wpp
wine_fn_config_makefile loader enable_loader clean,install-lib,manpage
wine_fn_config_makefile loader enable_loader clean,config,install-lib,manpage
wine_fn_config_program arp enable_arp install
wine_fn_config_program aspnet_regiis enable_aspnet_regiis install
wine_fn_config_program attrib enable_attrib install,po
......@@ -18090,7 +18101,7 @@ wine_fn_config_program winemenubuilder enable_winemenubuilder install
wine_fn_config_program winemine enable_winemine install,installbin,manpage,po
wine_fn_config_program winemsibuilder enable_winemsibuilder install
wine_fn_config_program winepath enable_winepath install,installbin,manpage
wine_fn_config_program winetest enable_winetest clean
wine_fn_config_program winetest enable_winetest clean,config
wine_fn_config_program winevdm enable_win16 install
wine_fn_config_program winhelp.exe16 enable_win16 install
wine_fn_config_program winhlp32 enable_winhlp32 install,po
......
......@@ -3494,9 +3494,9 @@ WINE_CONFIG_MAKEFILE([documentation],,[clean])
WINE_CONFIG_MAKEFILE([fonts],,[clean,install-lib])
WINE_CONFIG_MAKEFILE([include],,[clean,install-dev])
WINE_CONFIG_MAKEFILE([libs/port])
WINE_CONFIG_MAKEFILE([libs/wine],,[clean,install-dev,install-lib])
WINE_CONFIG_MAKEFILE([libs/wine],,[clean,config,install-dev,install-lib])
WINE_CONFIG_MAKEFILE([libs/wpp])
WINE_CONFIG_MAKEFILE([loader],,[clean,install-lib,manpage])
WINE_CONFIG_MAKEFILE([loader],,[clean,config,install-lib,manpage])
WINE_CONFIG_PROGRAM(arp,,[install])
WINE_CONFIG_PROGRAM(aspnet_regiis,,[install])
WINE_CONFIG_PROGRAM(attrib,,[install,po])
......@@ -3574,7 +3574,7 @@ WINE_CONFIG_PROGRAM(winemenubuilder,,[install])
WINE_CONFIG_PROGRAM(winemine,,[install,installbin,manpage,po])
WINE_CONFIG_PROGRAM(winemsibuilder,,[install])
WINE_CONFIG_PROGRAM(winepath,,[install,installbin,manpage])
WINE_CONFIG_PROGRAM(winetest,,[clean])
WINE_CONFIG_PROGRAM(winetest,,[clean,config])
WINE_CONFIG_PROGRAM(winevdm,enable_win16,[install])
WINE_CONFIG_PROGRAM(winhelp.exe16,enable_win16,[install])
WINE_CONFIG_PROGRAM(winhlp32,,[install,po])
......
......@@ -282,6 +282,10 @@ sub parse_makefile($)
{
die "Variable $1 in $file.in is obsolete";
}
if (/\@[A-Z_]+\@/) # config.status substitution variable
{
${$make{"=flags"}}{"config"} = 1;
}
}
if ($file =~ /^programs\/([^\/]+)\/Makefile/)
......
......@@ -171,7 +171,8 @@ struct makefile
static struct makefile *top_makefile;
static const char *makefile_name = "Makefile";
static const char *output_makefile_name = "Makefile";
static const char *input_makefile_name;
static const char *input_file_name;
static const char *output_file_name;
static const char *temp_file_name;
......@@ -184,7 +185,8 @@ static const char Usage[] =
"Usage: makedep [options] directories\n"
"Options:\n"
" -R from to Compute the relative path between two directories\n"
" -fxxx Store output in file 'xxx' (default: Makefile)\n";
" -fxxx Store output in file 'xxx' (default: Makefile)\n"
" -ixxx Read input from file 'xxx' (default: Makefile.in)\n";
#ifndef __GNUC__
......@@ -1460,6 +1462,28 @@ static struct incl_file *add_src_file( struct makefile *make, const char *name )
/*******************************************************************
* open_input_makefile
*/
static FILE *open_input_makefile( struct makefile *make )
{
FILE *ret;
if (make->base_dir)
input_file_name = base_dir_path( make, input_makefile_name );
else
input_file_name = output_makefile_name; /* always use output name for main Makefile */
input_line = 0;
if (!(ret = fopen( input_file_name, "r" )))
{
input_file_name = root_dir_path( input_file_name );
if (!(ret = fopen( input_file_name, "r" ))) fatal_perror( "open" );
}
return ret;
}
/*******************************************************************
* get_make_variable
*/
static char *get_make_variable( struct makefile *make, const char *name )
......@@ -1578,10 +1602,7 @@ static struct makefile *parse_makefile( const char *path, const char *separator
if (!strcmp( make->base_dir, "." )) make->base_dir = NULL;
}
input_file_name = base_dir_path( make, makefile_name );
if (!(file = fopen( input_file_name, "r" ))) fatal_perror( "open" );
input_line = 0;
file = open_input_makefile( make );
while ((buffer = get_line( file )))
{
if (separator && !strncmp( buffer, separator, strlen(separator) )) break;
......@@ -2538,15 +2559,16 @@ static void output_dependencies( struct makefile *make )
char buffer[1024];
FILE *src_file;
output_file_name = base_dir_path( make, makefile_name );
output_file_name = base_dir_path( make, output_makefile_name );
output_file = create_temp_file( output_file_name );
output_top_variables( make );
/* copy the contents of the source makefile */
if (!(src_file = fopen( output_file_name, "r" ))) fatal_perror( "open" );
src_file = open_input_makefile( make );
while (fgets( buffer, sizeof(buffer), src_file ))
if (fwrite( buffer, 1, strlen(buffer), output_file ) != strlen(buffer)) fatal_perror( "write" );
if (fclose( src_file )) fatal_perror( "close" );
input_file_name = NULL;
targets = output_sources( make, &testlist_files );
......@@ -2640,6 +2662,9 @@ static void update_makefile( const char *path )
list_init( &make->sources );
list_init( &make->includes );
/* FIXME: target dir has to exist to allow locating srcdir-relative include files */
if (make->base_dir) create_dir( make->base_dir );
for (var = source_vars; *var; var++)
{
value = get_expanded_make_var_array( make, *var );
......@@ -2700,7 +2725,10 @@ static int parse_option( const char *opt )
switch(opt[1])
{
case 'f':
if (opt[2]) makefile_name = opt + 2;
if (opt[2]) output_makefile_name = opt + 2;
break;
case 'i':
if (opt[2]) input_makefile_name = opt + 2;
break;
case 'R':
relative_dir_mode = 1;
......@@ -2762,6 +2790,8 @@ int main( int argc, char *argv[] )
for (i = 0; i < HASH_SIZE; i++) list_init( &files[i] );
if (!input_makefile_name) input_makefile_name = strmake( "%s.in", output_makefile_name );
top_makefile = parse_makefile( NULL, "# End of common header" );
linguas = get_expanded_make_var_array( top_makefile, "LINGUAS" );
......
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