aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/target.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/target.rs')
-rw-r--r--src/makefile/target.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/makefile/target.rs b/src/makefile/target.rs
index eb181cd..04603c9 100644
--- a/src/makefile/target.rs
+++ b/src/makefile/target.rs
@@ -42,26 +42,32 @@ impl Target {
}
let exists = metadata(&self.name).is_ok();
let newer_than_all_dependencies = self.prerequisites.iter().all(|t| {
- self.newer_than(&file.get_target(t).borrow())
+ file.get_target(t)
+ .ok()
+ .and_then(|t| self.newer_than(&t.borrow()))
.unwrap_or(false)
});
exists && newer_than_all_dependencies
}
- pub(crate) fn update(&self, file: &Makefile) {
+ pub(crate) fn update(&self, file: &Makefile) -> anyhow::Result<()> {
for prereq in &self.prerequisites {
- file.update_target(prereq);
+ file.update_target(prereq)?;
}
if !self.is_up_to_date(file) {
- self.execute_commands(file);
+ self.execute_commands(file)?;
}
self.already_updated.set(true);
+
+ Ok(())
}
- fn execute_commands(&self, file: &Makefile) {
+ fn execute_commands(&self, file: &Makefile) -> anyhow::Result<()> {
for command in &self.commands {
- command.execute(file, self);
+ command.execute(file, self)?;
}
+
+ Ok(())
}
}