mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-29 08:09:02 +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.
|
||||
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.
|
||||
|
||||
GNU Make is free software; you can redistribute it and/or modify
|
||||
|
@ -396,6 +396,47 @@ fatal_error_signal (sig)
|
|||
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.
|
||||
Set the flag in CHILD to say they've been deleted. */
|
||||
|
||||
|
@ -409,30 +450,12 @@ delete_child_targets (child)
|
|||
if (child->deleted)
|
||||
return;
|
||||
|
||||
/* Delete the file unless it's precious or not actually a file (phony). */
|
||||
if (!child->file->precious && !child->file->phony
|
||||
&& 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);
|
||||
}
|
||||
/* Delete the target file if it changed. */
|
||||
delete_target (child->file, (char *) 0);
|
||||
|
||||
/* Also remove any non-precious targets listed
|
||||
in the `also_make' member. */
|
||||
/* Also remove any non-precious targets listed in the `also_make' member. */
|
||||
for (d = child->file->also_make; d != 0; d = d->next)
|
||||
if (!d->file->precious && !d->file->phony)
|
||||
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);
|
||||
}
|
||||
delete_target (d->file, child->file->name);
|
||||
|
||||
child->deleted = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue