Alexandre Julliard : makedep:
Added support for generating dependencies of IDL client/proxy/server/
iid files.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Oct 16 13:55:37 CDT 2006
Module: wine
Branch: master
Commit: 8f31f92a73fdddf4fc79fa165cb668fb2977b67a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8f31f92a73fdddf4fc79fa165cb668fb2977b67a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Oct 16 17:19:07 2006 +0200
makedep: Added support for generating dependencies of IDL client/proxy/server/iid files.
---
tools/makedep.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 4 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c
index 300ed8d..759d3bd 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -229,6 +229,17 @@ static void add_include_path( const char
path->name = name;
}
+/*******************************************************************
+ * find_src_file
+ */
+static INCL_FILE *find_src_file( const char *name )
+{
+ INCL_FILE *file;
+
+ LIST_FOR_EACH_ENTRY( file, &sources, INCL_FILE, entry )
+ if (!strcmp( name, file->name )) return file;
+ return NULL;
+}
/*******************************************************************
* add_src_file
@@ -237,7 +248,10 @@ static void add_include_path( const char
*/
static INCL_FILE *add_src_file( const char *name )
{
- INCL_FILE *file = xmalloc( sizeof(*file) );
+ INCL_FILE *file;
+
+ if (find_src_file( name )) return NULL; /* we already have it */
+ file = xmalloc( sizeof(*file) );
memset( file, 0, sizeof(*file) );
file->name = xstrdup(name);
list_add_tail( &sources, &file->entry );
@@ -615,12 +629,58 @@ static void parse_c_file( INCL_FILE *pFi
/*******************************************************************
+ * parse_generated_idl
+ */
+static void parse_generated_idl( INCL_FILE *source )
+{
+ char *header, *basename;
+
+ basename = xstrdup( source->name );
+ basename[strlen(basename) - 4] = 0;
+ header = strmake( "%s.h", basename );
+ source->filename = xstrdup( source->name );
+
+ if (strendswith( source->name, "_c.c" ))
+ {
+ add_include( source, header, 0, 0 );
+ }
+ else if (strendswith( source->name, "_i.c" ))
+ {
+ add_include( source, "rpc.h", 0, 1 );
+ add_include( source, "rpcndr.h", 0, 1 );
+ add_include( source, "guiddef.h", 0, 1 );
+ }
+ else if (strendswith( source->name, "_p.c" ))
+ {
+ add_include( source, "rpcproxy.h", 0, 1 );
+ add_include( source, header, 0, 0 );
+ }
+ else if (strendswith( source->name, "_s.c" ))
+ {
+ add_include( source, header, 0, 0 );
+ }
+
+ free( header );
+ free( basename );
+}
+
+/*******************************************************************
* parse_file
*/
static void parse_file( INCL_FILE *pFile, int src )
{
FILE *file;
+ /* special case for source files generated from idl */
+ if (strendswith( pFile->name, "_c.c" ) ||
+ strendswith( pFile->name, "_i.c" ) ||
+ strendswith( pFile->name, "_p.c" ) ||
+ strendswith( pFile->name, "_s.c" ))
+ {
+ parse_generated_idl( pFile );
+ return;
+ }
+
file = src ? open_src_file( pFile ) : open_include_file( pFile );
if (!file) return;
@@ -686,7 +746,24 @@ static void output_src( FILE *file, INCL
}
else if (!strcmp( ext, "idl" )) /* IDL file */
{
- *column += fprintf( file, "%s.h: %s", obj, pFile->filename );
+ char *name;
+
+ *column += fprintf( file, "%s.h", obj );
+
+ name = strmake( "%s_c.c", obj );
+ if (find_src_file( name )) *column += fprintf( file, " %s", name );
+ free( name );
+ name = strmake( "%s_i.c", obj );
+ if (find_src_file( name )) *column += fprintf( file, " %s", name );
+ free( name );
+ name = strmake( "%s_p.c", obj );
+ if (find_src_file( name )) *column += fprintf( file, " %s", name );
+ free( name );
+ name = strmake( "%s_s.c", obj );
+ if (find_src_file( name )) *column += fprintf( file, " %s", name );
+ free( name );
+
+ *column += fprintf( file, ": %s", pFile->filename );
}
else
{
@@ -814,8 +891,7 @@ int main( int argc, char *argv[] )
for (i = 1; i < argc; i++)
{
- pFile = add_src_file( argv[i] );
- parse_file( pFile, 1 );
+ if ((pFile = add_src_file( argv[i] ))) parse_file( pFile, 1 );
}
LIST_FOR_EACH_ENTRY( pFile, &includes, INCL_FILE, entry ) parse_file( pFile, 0 );
output_dependencies();
More information about the wine-cvs
mailing list