static void CreateDepFile (const char* Name, FileType Types) /* Create a dependency file with the given name and place dependencies for * all files with the given types there. */ { /* Open the file */ FILE* F = fopen (Name, "w"); if (F == 0) { Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno)); } /* Print the output file followed by a tab char */ fprintf (F, "%s:\t", OutFile); /* Write out the dependencies for the output file */ WriteDep (F, Types); fputs ("\n\n", F); /* Write out a phony dependency for the included files */ WriteDep (F, Types); fputs (":\n\n", F); /* Close the file, check for errors */ if (fclose (F) != 0) { remove (Name); Fatal ("Cannot write to dependeny file (disk full?)"); } }
static void CreateDepFile (const char* Name, InputType Types) /* Create a dependency file with the given name and place dependencies for * all files with the given types there. */ { /* Open the file */ FILE* F = fopen (Name, "w"); if (F == 0) { Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno)); } /* If a dependency target was given, use it, otherwise use the output * file name as target, followed by a tab character. */ if (SB_IsEmpty (&DepTarget)) { WriteEscaped (F, OutputFilename); } else { WriteEscaped (F, SB_GetConstBuf (&DepTarget)); } fputs (":\t", F); /* Write out the dependencies for the output file */ WriteDep (F, Types); fputs ("\n\n", F); /* Write out a phony dependency for the included files */ WriteDep (F, Types); fputs (":\n\n", F); /* Close the file, check for errors */ if (fclose (F) != 0) { remove (Name); Fatal ("Cannot write to dependeny file (disk full?)"); } }