aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/makefile/input.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs
index e88314d..5a937f5 100644
--- a/src/makefile/input.rs
+++ b/src/makefile/input.rs
@@ -434,13 +434,11 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
Ok(x) => x,
Err(err) => return Some((line_number, Err(err))),
};
+ let line_without_comments = COMMENT.replace(&line, "$1").replace(r"\#", "#");
+ let line_without_comments = line_without_comments.trim_end();
// handle comments
let line = if settings.strip_comments {
- COMMENT
- .replace(&line, "$1")
- .replace(r"\#", "#")
- .trim_end()
- .to_owned()
+ line_without_comments.to_owned()
} else {
line
};
@@ -470,7 +468,8 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
#[cfg(feature = "full")]
{
- let cond_line = ConditionalLine::from(&line, |t| self.expand_macros(t));
+ let cond_line =
+ ConditionalLine::from(line_without_comments, |t| self.expand_macros(t));
let cond_line = match cond_line {
Ok(x) => x,
Err(err) => return Some((line_number, Err(err))),