aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/makefile/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs
index d7cc25e..7cc16c5 100644
--- a/src/makefile/mod.rs
+++ b/src/makefile/mod.rs
@@ -1,4 +1,5 @@
use std::cell::{Cell, RefCell};
+use std::collections::HashSet;
use std::env;
use std::fmt;
use std::path::{Path, PathBuf};
@@ -44,6 +45,7 @@ pub struct Makefile<'a> {
targets: DynamicTargetSet,
pub first_non_special_target: Option<String>,
args: &'a Args,
+ already_inferred: RefCell<HashSet<String>>,
// TODO borrow warnings from Python version
}
@@ -123,6 +125,7 @@ impl<'a> Makefile<'a> {
targets,
first_non_special_target,
args,
+ already_inferred: Default::default(),
}
}
@@ -170,6 +173,10 @@ impl<'a> Makefile<'a> {
if banned_names.contains(&name) {
bail!("no infinite recursion allowed");
}
+ if self.already_inferred.borrow().contains(name) {
+ return Ok(());
+ }
+ self.already_inferred.borrow_mut().insert(name.to_owned());
log::trace!("inferring {}, stack = {:?}", name, banned_names);
let mut new_target = None;
@@ -519,6 +526,7 @@ mod test {
targets: Default::default(),
first_non_special_target: None,
args: &args,
+ already_inferred: Default::default(),
};
let target = file.get_target("this-is-a-test-case")?;