aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/makefile/functions.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/makefile/functions.rs b/src/makefile/functions.rs
index 45ef925..9cd78f8 100644
--- a/src/makefile/functions.rs
+++ b/src/makefile/functions.rs
@@ -54,6 +54,10 @@ pub fn expand_call(
assert!(args.len() == 2 || args.len() == 3);
conditional::r#if(macros, &args[0], &args[1], args.get(2))
}
+ "or" => {
+ assert!(!args.is_empty());
+ conditional::or(macros, args.iter())
+ }
"and" => {
assert!(!args.is_empty());
conditional::and(macros, args.iter())
@@ -251,6 +255,19 @@ mod conditional {
}
}
+ pub fn or<'a>(
+ macros: &MacroSet,
+ args: impl Iterator<Item = &'a TokenString>,
+ ) -> Result<String> {
+ for arg in args {
+ let arg = macros.expand(arg)?;
+ if !arg.is_empty() {
+ return Ok(arg);
+ }
+ }
+ Ok(String::new())
+ }
+
pub fn and<'a>(
macros: &MacroSet,
args: impl Iterator<Item = &'a TokenString>,