aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/macro.rs')
-rw-r--r--src/makefile/macro.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/makefile/macro.rs b/src/makefile/macro.rs
index f00fdff..3444e2c 100644
--- a/src/makefile/macro.rs
+++ b/src/makefile/macro.rs
@@ -218,7 +218,9 @@ impl<'parent, 'lookup> Set<'parent, 'lookup> {
match token {
Token::Text(t) => result.push_str(t),
Token::MacroExpansion { name, replacement } => {
- let name = self.expand(name)?;
+ let name = self
+ .expand(name)
+ .wrap_err_with(|| format!("while expanding \"{}\"", name))?;
let internal_macro_names = &['@', '?', '<', '*'][..];
let internal_macro_suffices = &['D', 'F'][..];
let just_internal = name.len() == 1 && name.starts_with(internal_macro_names);
@@ -226,14 +228,18 @@ impl<'parent, 'lookup> Set<'parent, 'lookup> {
&& name.starts_with(internal_macro_names)
&& name.ends_with(internal_macro_suffices);
let macro_value = if just_internal || suffixed_internal {
- self.lookup_internal(&name)?
+ self.lookup_internal(&name)
+ .wrap_err_with(|| format!("while expanding $\"{}\"", name))?
} else {
self.get(&name).map_or_else(
|| {
self.warn(format!("undefined macro {}", name));
Ok(String::new())
},
- |x| self.expand(&x.text),
+ |x| {
+ self.expand(&x.text)
+ .wrap_err_with(|| format!("while expanding \"{}\"", &x.text))
+ },
)?
};
let macro_value = match replacement {