diff options
author | fjoe <fjoe@FreeBSD.org> | 2007-04-20 06:25:45 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2007-04-20 06:25:45 +0000 |
commit | 5abc85136d3414fb5078dd4b13d33911966818f4 (patch) | |
tree | 2488644fcf3899c882fa294fe7562b43dedfa30c /usr.bin | |
parent | d7e93cb21b8bf82161a075a608fb7bac5b15db25 (diff) | |
download | FreeBSD-src-5abc85136d3414fb5078dd4b13d33911966818f4.zip FreeBSD-src-5abc85136d3414fb5078dd4b13d33911966818f4.tar.gz |
When remaking makefiles check that mtime has actually changed.
This fixes infinite restart in the following case:
Makefile: foo
foo: bar
do-something
Unlike GNU make, BSD make considers "Makefile" node as remade even
if "foo" is up-to-date and was not actually rebuilt.
GNU make does not consider nodes without commands as remade if child nodes
were not actually rebuilt.
Most probably, more proper fix would be to bring BSD make behaviour in-line
with GNU make but this would be more intrusive change.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/main.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 8eceedf..e575ff2 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -704,6 +704,7 @@ Remake_Makefiles(void) Boolean saveTouchFlag = touchFlag; Boolean saveQueryFlag = queryFlag; Boolean saveNoExecute = noExecute; + int mtime; /* * Create node @@ -767,6 +768,7 @@ Remake_Makefiles(void) /* * Check and remake the makefile */ + mtime = Dir_MTime(gn); Compat_Make(gn, gn); /* @@ -785,9 +787,18 @@ Remake_Makefiles(void) * ABORTED gn was not remade because one of its inferiors * could not be made due to errors. */ - if (gn->made == MADE) - remade_cnt++; - else if (gn->made == ERROR) + if (gn->made == MADE) { + if (mtime != Dir_MTime(gn)) { + DEBUGF(MAKE, + ("%s updated (%d -> %d).\n", + gn->name, mtime, gn->mtime)); + remade_cnt++; + } else { + DEBUGF(MAKE, + ("%s not updated: skipping restart.\n", + gn->name)); + } + } else if (gn->made == ERROR) error_cnt++; else if (gn->made == ABORTED) { printf("`%s' not remade because of errors.\n", |