From 06eeecc0defec91a6e0fa8eb4acff27a59785e66 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 6 Apr 2021 20:37:24 -0600 Subject: skip rule-specific macros instead of trying to parse them as prereqs --- src/makefile/input.rs | 5 ++++- src/makefile/token.rs | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/makefile') diff --git a/src/makefile/input.rs b/src/makefile/input.rs index e5473a1..9c895e1 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -474,7 +474,6 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { let (targets, not_targets) = line_tokens .split_once(':') .ok_or_else(|| eyre!("read_rule couldn't find a ':' on line {}", line_number))?; - // TODO handle rule-specific variables let targets = self.expand_macros(&targets)?; let targets = targets.split_whitespace().collect::>(); let (prerequisites, mut commands) = match not_targets.split_once(';') { @@ -484,6 +483,10 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { } None => (not_targets, vec![]), }; + if prerequisites.contains_text("=") { + log::error!("rule-specific macros are not implemented yet"); + return Ok(()); + } let prerequisites = self.expand_macros(&prerequisites)?; let prerequisites = prerequisites .split_whitespace() diff --git a/src/makefile/token.rs b/src/makefile/token.rs index 63c48d9..294e80d 100644 --- a/src/makefile/token.rs +++ b/src/makefile/token.rs @@ -134,6 +134,16 @@ impl TokenString { _ => false, } } + + pub fn contains_text(&self, pattern: &str) -> bool { + self.0.iter().any(|x| { + if let Token::Text(x) = x { + x.contains(pattern) + } else { + false + } + }) + } } impl fmt::Display for TokenString { -- cgit v1.2.3