mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-01 10:04:49 +00:00
Formerly commands.c.~20~
This commit is contained in:
parent
1c0df127f8
commit
23e64a0b13
1 changed files with 46 additions and 23 deletions
69
commands.c
69
commands.c
|
@ -1,5 +1,5 @@
|
||||||
/* Command processing for GNU Make.
|
/* Command processing for GNU Make.
|
||||||
Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify
|
GNU Make is free software; you can redistribute it and/or modify
|
||||||
|
@ -396,6 +396,47 @@ fatal_error_signal (sig)
|
||||||
pfatal_with_name ("kill");
|
pfatal_with_name ("kill");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Delete FILE unless it's precious or not actually a file (phony),
|
||||||
|
and it has changed on disk since we last stat'd it. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
delete_target (file, on_behalf_of)
|
||||||
|
struct file *file;
|
||||||
|
char *on_behalf_of;
|
||||||
|
{
|
||||||
|
if (file->precious !! file->phony)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifndef NO_ARCHIVES
|
||||||
|
if (ar_name (file->name))
|
||||||
|
{
|
||||||
|
if (ar_member_date (file->name) != file->last_mtime)
|
||||||
|
{
|
||||||
|
if (on_behalf_of)
|
||||||
|
error ("*** [%s] Archive member `%s' may be bogus; not deleted",
|
||||||
|
on_behalf_of, file->name);
|
||||||
|
else
|
||||||
|
error ("*** Archive member `%s' may be bogus; not deleted",
|
||||||
|
file->name);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (stat (file->name, &st) == 0
|
||||||
|
&& S_ISREG (st.st_mode)
|
||||||
|
&& (time_t) st.st_mtime != file->last_mtime)
|
||||||
|
{
|
||||||
|
if (on_behalf_of)
|
||||||
|
error ("*** [%s] Deleting file `%s'", on_behalf_of, file->name);
|
||||||
|
else
|
||||||
|
error ("*** Deleting file `%s'", file->name);
|
||||||
|
if (unlink (child->file->name) < 0)
|
||||||
|
perror_with_name ("unlink: ", file->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Delete all non-precious targets of CHILD unless they were already deleted.
|
/* Delete all non-precious targets of CHILD unless they were already deleted.
|
||||||
Set the flag in CHILD to say they've been deleted. */
|
Set the flag in CHILD to say they've been deleted. */
|
||||||
|
|
||||||
|
@ -409,30 +450,12 @@ delete_child_targets (child)
|
||||||
if (child->deleted)
|
if (child->deleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Delete the file unless it's precious or not actually a file (phony). */
|
/* Delete the target file if it changed. */
|
||||||
if (!child->file->precious && !child->file->phony
|
delete_target (child->file, (char *) 0);
|
||||||
&& stat (child->file->name, &st) == 0
|
|
||||||
&& S_ISREG (st.st_mode)
|
|
||||||
&& (time_t) st.st_mtime != child->file->last_mtime)
|
|
||||||
{
|
|
||||||
error ("*** Deleting file `%s'", child->file->name);
|
|
||||||
if (unlink (child->file->name) < 0)
|
|
||||||
perror_with_name ("unlink: ", child->file->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Also remove any non-precious targets listed
|
/* Also remove any non-precious targets listed in the `also_make' member. */
|
||||||
in the `also_make' member. */
|
|
||||||
for (d = child->file->also_make; d != 0; d = d->next)
|
for (d = child->file->also_make; d != 0; d = d->next)
|
||||||
if (!d->file->precious && !d->file->phony)
|
delete_target (d->file, child->file->name);
|
||||||
if (stat (d->file->name, &st) == 0
|
|
||||||
&& S_ISREG (st.st_mode)
|
|
||||||
&& (time_t) st.st_mtime != d->file->last_mtime)
|
|
||||||
{
|
|
||||||
error ("*** [%s] Deleting file `%s'", child->file->name,
|
|
||||||
d->file->name);
|
|
||||||
if (unlink (d->file->name) < 0)
|
|
||||||
perror_with_name ("unlink: ", d->file->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
child->deleted = 1;
|
child->deleted = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue