aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/makefile/command_line.rs27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/makefile/command_line.rs b/src/makefile/command_line.rs
index 8756bc9..ec2c115 100644
--- a/src/makefile/command_line.rs
+++ b/src/makefile/command_line.rs
@@ -72,21 +72,38 @@ impl CommandLine {
}
pub fn execute(&self, file: &Makefile, target: &Target) -> eyre::Result<()> {
- let ignore_error = self.ignore_errors
+ let execution_line = file.expand_macros(&self.execution_line, Some(target))?;
+ let mut self_ignore_errors = self.ignore_errors;
+ let mut self_silent = self.silent;
+ let mut self_always_execute = self.always_execute;
+
+ // apparently some makefiles will just throw this shit in in macros? bruh moment tbh
+ let execution_line: String = {
+ let mut line_chars = execution_line.chars().peekable();
+ while let Some(x) = line_chars.next_if(|x| matches!(x, '-' | '@' | '+')) {
+ match x {
+ '-' => self_ignore_errors = true,
+ '@' => self_silent = true,
+ '+' => self_always_execute = true,
+ _ => unreachable!(),
+ }
+ }
+ line_chars.collect()
+ };
+
+ let ignore_error = self_ignore_errors
|| file.args.ignore_errors
|| file.special_target_has_prereq(".IGNORE", &target.name);
- let silent = (self.silent && !file.args.dry_run)
+ let silent = (self_silent && !file.args.dry_run)
|| file.args.silent
|| file.special_target_has_prereq(".SILENT", &target.name);
- let execution_line = file.expand_macros(&self.execution_line, Some(target))?;
-
if !silent {
println!("{}", execution_line);
}
let should_execute =
- self.always_execute || !(file.args.dry_run || file.args.question || file.args.touch);
+ self_always_execute || !(file.args.dry_run || file.args.question || file.args.touch);
if !should_execute {
return Ok(());
}