When generating the dependency file, escape spaces in file names.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5307 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -568,6 +568,21 @@ unsigned GetCurrentLine (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void WriteEscaped (FILE* F, const char* Name)
|
||||||
|
/* Write a file name to a dependency file escaping spaces */
|
||||||
|
{
|
||||||
|
while (*Name) {
|
||||||
|
if (*Name == ' ') {
|
||||||
|
/* Escape spaces */
|
||||||
|
fputc ('\\', F);
|
||||||
|
}
|
||||||
|
fputc (*Name, F);
|
||||||
|
++Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void WriteDep (FILE* F, InputType Types)
|
static void WriteDep (FILE* F, InputType Types)
|
||||||
/* Helper function. Writes all file names that match Types to the output */
|
/* Helper function. Writes all file names that match Types to the output */
|
||||||
{
|
{
|
||||||
@@ -590,8 +605,8 @@ static void WriteDep (FILE* F, InputType Types)
|
|||||||
fputc (' ', F);
|
fputc (' ', F);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the dependency */
|
/* Print the dependency escaping spaces */
|
||||||
fputs (IF->Name, F);
|
WriteEscaped (F, IF->Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,8 +617,6 @@ static void CreateDepFile (const char* Name, InputType Types)
|
|||||||
* all files with the given types there.
|
* all files with the given types there.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const char* Target;
|
|
||||||
|
|
||||||
/* Open the file */
|
/* Open the file */
|
||||||
FILE* F = fopen (Name, "w");
|
FILE* F = fopen (Name, "w");
|
||||||
if (F == 0) {
|
if (F == 0) {
|
||||||
@@ -614,11 +627,11 @@ static void CreateDepFile (const char* Name, InputType Types)
|
|||||||
* file name as target, followed by a tab character.
|
* file name as target, followed by a tab character.
|
||||||
*/
|
*/
|
||||||
if (SB_IsEmpty (&DepTarget)) {
|
if (SB_IsEmpty (&DepTarget)) {
|
||||||
Target = OutputFilename;
|
WriteEscaped (F, OutputFilename);
|
||||||
} else {
|
} else {
|
||||||
Target = SB_GetConstBuf (&DepTarget);
|
WriteEscaped (F, SB_GetConstBuf (&DepTarget));
|
||||||
}
|
}
|
||||||
fprintf (F, "%s:\t", Target);
|
fputs (":\t", F);
|
||||||
|
|
||||||
/* Write out the dependencies for the output file */
|
/* Write out the dependencies for the output file */
|
||||||
WriteDep (F, Types);
|
WriteDep (F, Types);
|
||||||
|
|||||||
Reference in New Issue
Block a user