aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r--src/makefile/input.rs25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs
index f1d4f70..fccea3b 100644
--- a/src/makefile/input.rs
+++ b/src/makefile/input.rs
@@ -16,6 +16,7 @@ use crate::args::Args;
use super::command_line::CommandLine;
#[cfg(feature = "full")]
use super::conditional::{Line as ConditionalLine, State as ConditionalState};
+#[cfg(feature = "full")]
use super::eval_context::DeferredEvalContext;
use super::inference_rules::InferenceRule;
#[cfg(feature = "full")]
@@ -594,6 +595,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
log::error!("rule-specific macros are not implemented yet");
return Ok(());
}
+ #[cfg(feature = "full")]
let mut deferred_eval_context = DeferredEvalContext::new(self);
let prerequisites = self
.macros
@@ -630,7 +632,12 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
Ok(macro_pieces.join(" "))
})
- .expand(&prerequisites, Some(&mut deferred_eval_context))?;
+ .expand(
+ &prerequisites,
+ #[cfg(feature = "full")]
+ Some(&mut deferred_eval_context),
+ )?;
+ #[cfg(feature = "full")]
for child in deferred_eval_context {
self.extend(child);
}
@@ -903,8 +910,14 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
}
fn expand_macros(&mut self, text: &TokenString) -> Result<String> {
+ #[cfg(feature = "full")]
let mut deferred_eval_context = DeferredEvalContext::new(self);
- let result = self.expand_macros_deferred_eval(text, &mut deferred_eval_context);
+ let result = self.expand_macros_deferred_eval(
+ text,
+ #[cfg(feature = "full")]
+ &mut deferred_eval_context,
+ );
+ #[cfg(feature = "full")]
for child in deferred_eval_context {
self.extend(child);
}
@@ -914,10 +927,14 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
fn expand_macros_deferred_eval(
&self,
text: &TokenString,
- deferred_eval_context: &mut DeferredEvalContext<R>,
+ #[cfg(feature = "full")] deferred_eval_context: &mut DeferredEvalContext<R>,
) -> Result<String> {
self.macros
- .expand(text, Some(deferred_eval_context))
+ .expand(
+ text,
+ #[cfg(feature = "full")]
+ Some(deferred_eval_context),
+ )
.wrap_err_with(|| format!("while expanding \"{}\"", text))
}