aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r--src/makefile/input.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs
index 5883590..700bf4b 100644
--- a/src/makefile/input.rs
+++ b/src/makefile/input.rs
@@ -147,6 +147,7 @@ pub struct MakefileReader<'a, 'parent, R: BufRead> {
pub macros: MacroSet<'parent, 'static>,
pub targets: HashMap<String, Target>,
pub first_non_special_target: Option<String>,
+ pub failed_includes: Vec<String>,
args: &'a Args,
lines_iter: Peekable<LineNumbers<String, IoError, Lines<R>>>,
// join with escaped_newline_replacement to get the actual line
@@ -194,6 +195,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
macros,
targets: HashMap::new(),
first_non_special_target: None,
+ failed_includes: Vec::new(),
args,
lines_iter: source.lines().line_numbered().peekable(),
pending_line: None,
@@ -235,9 +237,15 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
for field in fields {
let child_macros = self.macros.with_overlay();
let child = MakefileReader::read_file(self.args, child_macros, field)
- .with_context(|| format!("while including {}", field))?
- .finish();
- self.extend(child);
+ .with_context(|| format!("while including {}", field));
+ if let Ok(child) = child {
+ let child = child.finish();
+ self.extend(child);
+ } else {
+ // TODO handle non-file-not-found errors
+ log::error!("included makefile {} not found", field);
+ self.failed_includes.push(field.to_owned());
+ }
}
continue;
}
@@ -655,6 +663,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
macros: self.macros.data,
targets: self.targets,
first_non_special_target: self.first_non_special_target,
+ failed_includes: self.failed_includes,
}
}
@@ -665,6 +674,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
if self.first_non_special_target.is_none() {
self.first_non_special_target = new.first_non_special_target;
}
+ self.failed_includes.extend(new.failed_includes);
}
}
@@ -673,6 +683,7 @@ pub struct FinishedMakefileReader {
pub macros: HashMap<String, Macro>,
pub targets: HashMap<String, Target>,
pub first_non_special_target: Option<String>,
+ pub failed_includes: Vec<String>,
}
#[cfg(test)]