From 2da6fc368f29071f7fb7f1eb2b9ffbe38be1a0d8 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 14 Jan 2014 21:16:40 +0100 Subject: [PATCH] makedep: Make the makefile mode the default behavior and remove obsolete options. --- aclocal.m4 | 4 +-- configure | 4 +-- tools/makedep.c | 89 +++++++++---------------------------------------- 3 files changed, 20 insertions(+), 77 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index bb483209f56..c582890a3b1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -227,11 +227,11 @@ wine_fn_depend_rules () { wine_fn_append_rule \ "$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) - @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) -M $ac_dir + @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir depend: $ac_dir/depend .PHONY: $ac_dir/depend $ac_dir/depend: \$(MAKEDEP) dummy - @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) -M $ac_dir" + @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir" } wine_fn_pot_rules () diff --git a/configure b/configure index 27251d00c1e..2612bdce049 100755 --- a/configure +++ b/configure @@ -7075,11 +7075,11 @@ wine_fn_depend_rules () { wine_fn_append_rule \ "$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) - @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) -M $ac_dir + @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir depend: $ac_dir/depend .PHONY: $ac_dir/depend $ac_dir/depend: \$(MAKEDEP) dummy - @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) -M $ac_dir" + @./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir" } wine_fn_pot_rules () diff --git a/tools/makedep.c b/tools/makedep.c index 108cdb05ec9..3a656e5d103 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -111,24 +111,17 @@ static const char *Separator = "### Dependencies"; static const char *input_file_name; static const char *output_file_name; static const char *temp_file_name; -static int parse_makefile_mode; static int relative_dir_mode; static int input_line; static int output_column; static FILE *output_file; static const char Usage[] = - "Usage: makedep [options] [files]\n" + "Usage: makedep [options] directories\n" "Options:\n" - " -Idir Search for include files in directory 'dir'\n" - " -Cdir Search for source files in directory 'dir'\n" - " -Sdir Set the top source directory\n" - " -Tdir Set the top object directory\n" - " -Pdir Set the parent source directory\n" - " -M dirs Parse the makefiles from the specified directories\n" - " -R from to Compute the relative path between two directories\n" - " -fxxx Store output in file 'xxx' (default: Makefile)\n" - " -sxxx Use 'xxx' as separator (default: \"### Dependencies\")\n"; + " -R from to Compute the relative path between two directories\n" + " -fxxx Store output in file 'xxx' (default: Makefile)\n" + " -sxxx Use 'xxx' as separator (default: \"### Dependencies\")\n"; #ifndef __GNUC__ @@ -313,19 +306,6 @@ static void strarray_addall( struct strarray *array, struct strarray added ) } -/******************************************************************* - * strarray_insert - */ -static void strarray_insert( struct strarray *array, unsigned int pos, const char *str ) -{ - unsigned int i; - - strarray_add( array, NULL ); - for (i = array->count - 1; i > pos; i--) array->str[i] = array->str[i - 1]; - array->str[pos] = str; -} - - /******************************************************************* * strarray_add_uniq */ @@ -520,20 +500,6 @@ static char *tools_path( const char *name ) } -/******************************************************************* - * init_paths - */ -static void init_paths(void) -{ - /* ignore redundant source paths */ - if (src_dir && !strcmp( src_dir, "." )) src_dir = NULL; - if (top_src_dir && top_obj_dir && !strcmp( top_src_dir, top_obj_dir )) top_src_dir = NULL; - if (tools_dir && top_obj_dir && !strcmp( tools_dir, top_obj_dir )) tools_dir = NULL; - - strarray_insert( &include_args, 0, strmake( "-I%s", top_dir_path( "include" ))); -} - - /******************************************************************* * get_line */ @@ -2156,6 +2122,11 @@ static void update_makefile( const char *path ) tools_dir = get_expanded_make_variable( "TOOLSDIR" ); tools_ext = get_expanded_make_variable( "TOOLSEXT" ); + /* ignore redundant source paths */ + if (src_dir && !strcmp( src_dir, "." )) src_dir = NULL; + if (top_src_dir && top_obj_dir && !strcmp( top_src_dir, top_obj_dir )) top_src_dir = NULL; + if (tools_dir && top_obj_dir && !strcmp( tools_dir, top_obj_dir )) tools_dir = NULL; + appmode = get_expanded_make_var_array( "APPMODE" ); dllflags = get_expanded_make_var_array( "DLLFLAGS" ); imports = get_expanded_make_var_array( "IMPORTS" ); @@ -2168,6 +2139,7 @@ static void update_makefile( const char *path ) include_args = empty_strarray; define_args = empty_strarray; strarray_add( &define_args, "-D__WINESRC__" ); + strarray_add( &include_args, strmake( "-I%s", top_dir_path( "include" ))); if (!tools_ext) tools_ext = ""; @@ -2179,8 +2151,6 @@ static void update_makefile( const char *path ) strarray_add_uniq( &define_args, value.str[i] ); strarray_addall( &define_args, get_expanded_make_var_array( "EXTRADEFS" )); - init_paths(); - if (use_msvcrt) { strarray_add( &dllflags, get_expanded_make_variable( "MSVCRTFLAGS" )); @@ -2249,27 +2219,9 @@ static int parse_option( const char *opt ) } switch(opt[1]) { - case 'I': - if (opt[2]) strarray_add_uniq( &include_args, opt ); - break; - case 'C': - src_dir = opt + 2; - break; - case 'S': - top_src_dir = opt + 2; - break; - case 'T': - top_obj_dir = opt + 2; - break; - case 'P': - parent_dir = opt + 2; - break; case 'f': if (opt[2]) makefile_name = opt + 2; break; - case 'M': - parse_makefile_mode = 1; - break; case 'R': relative_dir_mode = 1; break; @@ -2277,8 +2229,6 @@ static int parse_option( const char *opt ) if (opt[2]) Separator = opt + 2; else Separator = NULL; break; - case 'x': - break; /* ignored */ default: fprintf( stderr, "Unknown option '%s'\n%s", opt, Usage ); exit(1); @@ -2293,7 +2243,6 @@ static int parse_option( const char *opt ) int main( int argc, char *argv[] ) { const char *makeflags = getenv( "MAKEFLAGS" ); - struct incl_file *pFile; int i, j; if (makeflags) parse_makeflags( makeflags ); @@ -2323,6 +2272,11 @@ int main( int argc, char *argv[] ) exit( 0 ); } + if (argc <= 1) + { + fprintf( stderr, "%s", Usage ); + exit( 1 ); + } atexit( cleanup_files ); signal( SIGTERM, exit_on_signal ); signal( SIGINT, exit_on_signal ); @@ -2330,17 +2284,6 @@ int main( int argc, char *argv[] ) signal( SIGHUP, exit_on_signal ); #endif - if (parse_makefile_mode) - { - for (i = 1; i < argc; i++) update_makefile( argv[i] ); - exit( 0 ); - } - - init_paths(); - for (i = 1; i < argc; i++) add_src_file( argv[i] ); - add_generated_sources(); - - LIST_FOR_EACH_ENTRY( pFile, &includes, struct incl_file, entry ) parse_file( pFile, 0 ); - output_dependencies( makefile_name ); + for (i = 1; i < argc; i++) update_makefile( argv[i] ); return 0; }