aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-06 16:35:35 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-06 16:35:35 -0600
commite18364423529e5d76c381f99c655a6b48ecca030 (patch)
tree3dcd3f5cf892eb1e5718d6abf38979c4f9615412
parent7f3f397015e0b417ef6a35fec819ec1d3761d5b8 (diff)
downloadmakers-e18364423529e5d76c381f99c655a6b48ecca030.tar.gz
makers-e18364423529e5d76c381f99c655a6b48ecca030.zip
allow leading `-` to suppress errors on `include`
-rw-r--r--src/makefile/input.rs14
1 files 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;