[PATCH] makedep: Added dlldata support to makedep

Roy Shea roy at cs.hmc.edu
Thu Oct 18 15:36:40 CDT 2007


Added "-D" option to makedep to support generation of dependencies for
the dlldata.c file that is created by widl.

-------------- next part --------------
 
 tools/makedep.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index e96cdf6..d90b754 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -74,6 +74,7 @@ static const char Usage[] =
     "Options:\n"
     "   -Idir   Search for include files in directory 'dir'\n"
     "   -Cdir   Search for source files in directory 'dir'\n"
+    "   -Dfiles Use space separated list of idl 'files' to create dlldata.c\n"
     "   -Sdir   Set the top source directory\n"
     "   -Sdir   Set the top object directory\n"
     "   -fxxx   Store output in file 'xxx' (default: Makefile)\n"
@@ -722,6 +723,38 @@ static void parse_generated_idl( INCL_FILE *source )
     free( basename );
 }
 
+
+/*******************************************************************
+ *          parse_generated_dlldata
+ */
+static void parse_generated_dlldata( const char *sources )
+{
+    INCL_FILE *pFile;
+    char *source;
+    const char *start, *end;
+
+    pFile = add_src_file( "dlldata.c" );
+    pFile->filename = xstrdup( pFile->name );
+    start = end = sources;
+    while (*end != '\0') {
+        ++end;
+        if (*end == ' ' || *end == '\0')
+        {
+            if (start != end)
+            {
+                source = xmalloc( end-start+1 );
+                strncpy( source, start, end-start);
+                source[end-start] = '\0';
+                add_include( pFile, source, 0, 0);
+                free( source );
+            }
+            start = end;
+            if (*end == '\0') break;
+        }
+    }
+}
+
+
 /*******************************************************************
  *         parse_file
  */
@@ -738,6 +771,11 @@ static void parse_file( INCL_FILE *pFile, int src )
         parse_generated_idl( pFile );
         return;
     }
+    if (!strcmp( pFile->name, "dlldata.c"))
+    {
+        /* dependencies generated from -D command line option */
+        return;
+    }
 
     file = src ? open_src_file( pFile ) : open_include_file( pFile );
     if (!file) return;
@@ -828,6 +866,10 @@ static void output_src( FILE *file, INCL_FILE *pFile, int *column )
 
             *column += fprintf( file, ": %s", pFile->filename );
         }
+        else if (!strcmp( obj, "dlldata" ))  /* dlldata file */
+        {
+            *column += fprintf( file, "%s.o %s.c:", obj, obj );
+        }
         else
         {
             *column += fprintf( file, "%s.o: %s", obj, pFile->filename );
@@ -891,6 +933,9 @@ static void parse_option( const char *opt )
     case 'C':
         src_dir = opt + 2;
         break;
+    case 'D':
+        parse_generated_dlldata( opt+2 );
+        break;
     case 'S':
         top_src_dir = opt + 2;
         break;
-- 
1.5.3.1



More information about the wine-patches mailing list