Don't generate output file for .PHONY targets

This commit is contained in:
Justine Tunney 2022-08-10 15:52:06 -07:00
parent 7e1c78b4f3
commit 37ebd8f8d5

View file

@ -1807,7 +1807,8 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
* creation so that it can't be deleted by the command which * creation so that it can't be deleted by the command which
* must truncate when writing its output. * must truncate when writing its output.
*/ */
if (strlen(c->file->name) < PATH_MAX) if (!c->file->phony &&
strlen(c->file->name) < PATH_MAX)
{ {
int fd, rc, err = errno; int fd, rc, err = errno;
strcpy (outpathbuf, c->file->name); strcpy (outpathbuf, c->file->name);