From e18364423529e5d76c381f99c655a6b48ecca030 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 6 Apr 2021 16:35:35 -0600 Subject: allow leading `-` to suppress errors on `include` --- src/makefile/input.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/makefile/input.rs b/src/makefile/input.rs index ecf195a..283842f 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -229,7 +229,11 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { let line = line?; // handle include lines - if let Some(line) = line.strip_prefix("include ") { + let original_line = &line; + if let Some(line) = line + .strip_prefix("include ") + .or(line.strip_prefix("-include ")) + { // remove extra leading space let line = line.trim_start(); let line = self.expand_macros(&tokenize(line)?)?; @@ -244,9 +248,11 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { 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()); + if !original_line.starts_with('-') { + // TODO handle non-file-not-found errors + log::error!("included makefile {} not found", field); + self.failed_includes.push(field.to_owned()); + } } } continue; -- cgit v1.2.3