about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--redo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/redo.c b/redo.c
index 18c89dd..2b6a406 100644
--- a/redo.c
+++ b/redo.c
@@ -604,6 +604,13 @@ create_pool()
 	}
 }
 
+static int
+sourcefile(char *target)
+{
+	char *depfile = targetdep(target);
+	return access(target, F_OK) == 0 && access(depfile, F_OK) != 0;
+}
+
 static void
 redo_ifchange(int targetc, char *targetv[])
 {
@@ -628,7 +635,7 @@ redo_ifchange(int targetc, char *targetv[])
 		if (targeti < targetc) {
 			char *target = targetv[targeti];
 
-			if (skip[targeti]) {
+			if (skip[targeti] || sourcefile(target)) {
 				targeti++;
 				continue;
 			}