scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 24af11c699aa8d687459047f106f571dc06ea3aa
parent f1454a93302482b594c7f97faab389ed1437dea8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 21 Jan 2024 09:06:31 +0100

make: Calculate target stamp in rebuild()

The time stamp of every file was calculate when the target
was created in lookup(), and it was not updated ever. It
lead to keep the old timestamp when the target was checked
in different rules, impling build it several times because
the contidion that fired the first rule kept being  valid
forever (for example when the file didn't exist).

Diffstat:
Msrc/cmd/make/rules.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cmd/make/rules.c b/src/cmd/make/rules.c @@ -46,7 +46,6 @@ lookup(char *name) tp->name = estrdup(name); tp->target = tp->name; tp->req = NULL; - tp->stamp = stamp(name); tp->ndeps = 0; tp->deps = NULL; tp->actions = NULL; @@ -453,6 +452,8 @@ rebuild(Target *tp, int *buildp) debug("checking rebuild of %s", tp->name); + tp->stamp = stamp(tp->name); + err = need = 0; for (p = tp->deps; p && *p; ++p) { if (stop)