diff --git a/reactos/tools/depends.c b/reactos/tools/depends.c index ed73b03d58a..4d8cbaab869 100644 --- a/reactos/tools/depends.c +++ b/reactos/tools/depends.c @@ -5,9 +5,11 @@ int main(int argc, char* argv[]) { char buf[512]; + char buf2[512]; char ch; - unsigned int i; + unsigned int i, j; char* dot; + char* ext; char* prefix; FILE* out; @@ -50,14 +52,53 @@ int main(int argc, char* argv[]) { 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; } - 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) {