FW: Modified makedep to handle #include <>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hmm. This was meant for this list instead.

-----Original Message-----
From: Patrik Stridvall 
Sent: Wednesday, February 13, 2002 8:09 PM
To: Wine-Devel (E-mail)
Subject: Modified makedep to handle #include <>


I have been working some more on a Makefile.in to 
.dsp/.dsw converter for working in Microsoft Developer
studio and it is comming along fine.

Anyway one of the the problems compiling with MSVC
using the Microsoft headers is that all Wine only
includes in wine/include can't use for example:

#include "windef.h"

it must use

#include <windef.h>

otherwise Wine's windef.h in the same directory is used. 

The problem as you pointed out is that makedep.c
can't handle this. Here is a patch so it can.

BTW. If you apply this patch or a similar should
all .h and .c files be converted or should I
just do the absolute minimum ie the Wine specific
include (.h files) under wine/include.
Files like heap.h for example.

* tools/makedep.c:
Modified makedep to handle #include <>
for the Windows includes correctly.

---8<---

Index: wine/tools/makedep.c
===================================================================
RCS file: /home/wine/wine/tools/makedep.c,v
retrieving revision 1.7
diff -u -u -r1.7 makedep.c
--- wine/tools/makedep.c	2000/12/13 21:27:26	1.7
+++ wine/tools/makedep.c	2002/02/13 16:40:21
@@ -4,6 +4,8 @@
  * Copyright 1996 Alexandre Julliard
  */
 
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -185,6 +187,31 @@
     return file;
 }
 
+/*******************************************************************
+ *         find_include_file
+ */
+static int find_include_file(char *name)
+{
+    INCL_PATH *path;
+    int found = 0;
+
+    for (path = firstPath; path; path = path->next)
+    {
+        struct stat buf;
+        char *filename = xmalloc(strlen(path->name) + strlen(name) + 2);
+        strcpy( filename, path->name );
+        strcat( filename, "/" );
+        strcat( filename, name );
+        if (!stat( filename, &buf ))
+        {
+	    found = 1;
+        }
+        free( filename );
+	if(found) break;
+    }
+    return found;
+}
+
 
 /*******************************************************************
  *         open_include_file
@@ -260,6 +287,7 @@
 
     while (fgets( buffer, sizeof(buffer)-1, file ))
     {
+        char qoute;
         char *p = buffer;
         line++;
         while (*p && isspace(*p)) p++;
@@ -268,9 +296,11 @@
         if (strncmp( p, "include", 7 )) continue;
         p += 7;
         while (*p && isspace(*p)) p++;
-        if (*p++ != '\"') continue;
+        if (*p != '\"' && *p != '<' ) continue;
+	qoute = *p++;
+        if(qoute == '<') qoute = '>';
         include = p;
-        while (*p && (*p != '\"')) p++;
+        while (*p && (*p != qoute)) p++;
         if (!*p)
         {
             fprintf( stderr, "%s:%d: Malformed #include directive\n",
@@ -278,7 +308,9 @@
             exit(1);
         }
         *p = 0;
-        add_include( pFile, include, line );
+	if (qoute == '\"' || find_include_file(include)) {
+	    add_include( pFile, include, line );
+	}
     }
     fclose(file);
 }





[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux