Module: wine Branch: master Commit: 73b0f6517700cc846507fe3986c4e96ffe7df6b8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=73b0f6517700cc846507fe3986...
Author: Francois Gouget fgouget@free.fr Date: Tue Jun 30 10:25:05 2009 +0200
makedep: Add support for multiple object file extensions.
---
tools/makedep.c | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 4194073..e2ca5ad 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -53,6 +53,14 @@ typedef struct _INCL_FILE static struct list sources = LIST_INIT(sources); static struct list includes = LIST_INIT(includes);
+typedef struct _OBJECT_EXTENSION +{ + struct list entry; + const char *extension; +} OBJECT_EXTENSION; + +static struct list object_extensions = LIST_INIT(object_extensions); + typedef struct _INCL_PATH { struct list entry; @@ -218,6 +226,18 @@ static char *get_line( FILE *file ) }
/******************************************************************* + * add_object_extension + * + * Add an extension for object files. + */ +static void add_object_extension( const char *ext ) +{ + OBJECT_EXTENSION *object_extension = xmalloc( sizeof(*object_extension) ); + list_add_tail( &object_extensions, &object_extension->entry ); + object_extension->extension = ext; +} + +/******************************************************************* * add_include_path * * Add a directory to the include path. @@ -857,7 +877,10 @@ static int output_src( FILE *file, INCL_FILE *pFile, int *column ) } else { - *column += fprintf( file, "%s.o: %s", obj, pFile->filename ); + OBJECT_EXTENSION *ext; + LIST_FOR_EACH_ENTRY( ext, &object_extensions, OBJECT_EXTENSION, entry ) + *column += fprintf( file, "%s.%s ", obj, ext->extension ); + *column += fprintf( file, ": %s", pFile->filename ); } } free( obj ); @@ -973,6 +996,9 @@ static void parse_option( const char *opt ) if (opt[2]) Separator = opt + 2; else Separator = NULL; break; + case 'x': + if (opt[2]) add_object_extension( opt + 2 ); + break; default: fprintf( stderr, "Unknown option '%s'\n", opt ); fprintf( stderr, Usage, ProgramName ); @@ -1008,6 +1034,10 @@ int main( int argc, char *argv[] ) 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;
+ /* set the default extension list for object files */ + if (list_empty( &object_extensions )) + add_object_extension( "o" ); + /* get rid of absolute paths that don't point into the source dir */ LIST_FOR_EACH_ENTRY_SAFE( path, next, &paths, INCL_PATH, entry ) {