diff options
| -rw-r--r-- | src/makefile/functions.rs | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/src/makefile/functions.rs b/src/makefile/functions.rs index 46caca5..2098334 100644 --- a/src/makefile/functions.rs +++ b/src/makefile/functions.rs @@ -113,6 +113,11 @@ pub fn expand_call(              origin(macros, &args[0])          } +        "error" => { +            assert_eq!(args.len(), 1); +            meta::error(macros, &args[0]) +        } +          "shell" => {              assert_eq!(args.len(), 1);              shell(macros, &args[0]) @@ -415,6 +420,15 @@ pub fn origin(macros: &MacroSet, variable: &TokenString) -> Result<String> {      Ok(macros.origin(&variable).to_owned())  } +mod meta { +    use super::*; + +    pub fn error(macros: &MacroSet, text: &TokenString) -> Result<String> { +        let text = macros.expand(text)?; +        bail!("{}", text); +    } +} +  pub fn shell(macros: &MacroSet, command: &TokenString) -> Result<String> {      // TODO bring this in from command_line      let command = macros.expand(command)?; |