Add support for spaces in filenames (3/x)

This takes care of dependencies.

GNU Make is required for this to work.
This commit is contained in:
Pierre Pronchery 2019-02-12 20:26:40 +01:00
parent 48e004bb22
commit 569bed6399

View File

@ -2974,17 +2974,20 @@ static int _makefile_is_phony(Makefile * makefile, char const * target)
/* makefile_expand */ /* makefile_expand */
static int _makefile_expand(Makefile * makefile, char const * field) static int _makefile_expand(Makefile * makefile, char const * field)
{ {
String * q;
int res; int res;
char c;
if((q = string_new(field)) == NULL if(field == NULL)
|| string_replace(&q, ",", " ") != 0)
{
string_delete(q);
return -1; return -1;
res = _makefile_print(makefile, " ");
while((c = *(field++)) != '\0')
{
if(c == ' ' || c == '\t')
res |= _makefile_print(makefile, "\\");
else if(c == ',')
c = ' ';
res |= _makefile_print(makefile, "%c", c);
} }
res = _makefile_print(makefile, " %s", q);
string_delete(q);
return (res >= 0) ? 0 : -1; return (res >= 0) ? 0 : -1;
} }