- Replaced the target extension with '.h.gch' if the source extension was '.h'
authorHartmut Birr <osexpert@googlemail.com>
Tue, 7 Sep 2004 08:14:30 +0000 (08:14 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Tue, 7 Sep 2004 08:14:30 +0000 (08:14 +0000)
svn path=/trunk/; revision=10795

reactos/tools/depends.c

index ed73b03..4d8cbaa 100644 (file)
@@ -5,9 +5,11 @@
 int main(int argc, char* argv[])
 {
   char buf[512];
 int main(int argc, char* argv[])
 {
   char buf[512];
+  char buf2[512];
   char ch;
   char ch;
-  unsigned int i;
+  unsigned int i, j;
   char* dot;
   char* dot;
+  char* ext;
   char* prefix;
   FILE* out;
 
   char* prefix;
   FILE* out;
 
@@ -50,14 +52,53 @@ int main(int argc, char* argv[])
     {
       return(0);
     }
     {
       return(0);
     }
+  i = 0;
+  while ((ch = fgetc(stdin)) == ' ' && ch != EOF)
+    {
+      buf2[i] = ch;
+      i++;
+    }
+  if (i == 0)
+    {
+      return 0;
+    }
+  if (ch != EOF)
+    {
+      buf2[i] = ch;
+      i++;
+    }
+  j = i;
+  while ((ch = fgetc(stdin)) != ' ' && ch != EOF)
+    {
+      buf2[j] = ch;
+      j++;
+    }
+  buf2[j] = 0;
+  if (i == j)
+    {
+      return 0;
+    }
+
+  ext = strrchr(buf2, '.');
+  if (ext != NULL)
+    {
+      if (0 == strcmp(ext, ".h"))
+        {
+         ext = "h.gch";
+       }
+      else
+        {
+         ext = NULL;
+       }
+    }
 
   dot = strrchr(buf, '.');
   if (dot != NULL)
     {
       *dot = 0;
     }
 
   dot = strrchr(buf, '.');
   if (dot != NULL)
     {
       *dot = 0;
     }
-  fprintf(out, "%s/.%s.TAG %s/.%s.d %s/%s.o:", prefix, buf, prefix, buf, 
-         prefix,buf);
+  fprintf(out, "%s/.%s.TAG %s/.%s.d %s/%s.%s:%s ", prefix, buf, prefix, buf, 
+          prefix,buf,ext ? ext : "o" , buf2);
 
   while ((ch = fgetc(stdin)) != EOF)
     {
 
   while ((ch = fgetc(stdin)) != EOF)
     {