about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-02-07 15:07:06 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-02-07 15:07:06 +0100
commit8c328a87a2cf061499bb2e28b4322bf5d35ab362 (patch)
tree2a8e22cd7b20f3d9ae0a8798551f44885fc9aeb0
parent11d6ac4107bee4368bb2618e1f256822558e1ccc (diff)
downloadredo-c-8c328a87a2cf061499bb2e28b4322bf5d35ab362.tar.gz
redo-c-8c328a87a2cf061499bb2e28b4322bf5d35ab362.tar.xz
redo-c-8c328a87a2cf061499bb2e28b4322bf5d35ab362.zip
take existence of a dofile into account when checking for sourcefile
This resolves issues when the .dep.redo went missing or the file
was built by other means.

Closes #6.
-rw-r--r--redo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/redo.c b/redo.c
index 141434c..2a297e9 100644
--- a/redo.c
+++ b/redo.c
@@ -398,7 +398,14 @@ static int
 sourcefile(char *target)
 {
 	target = targetchdir(target);
-	return access(target, F_OK) == 0 && access(targetdep(target), F_OK) != 0;
+
+	if (access(targetdep(target), F_OK) == 0)
+		return 0;
+
+	if (!fflag)
+		return access(target, F_OK) == 0;
+
+	return find_dofile(target) == 0;
 }
 
 static int