diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-20 18:36:11 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-20 18:36:11 -0600 |
commit | 706536abe03c5cdfd73d1aa3f34f8b4d40680b79 (patch) | |
tree | 30411a75922353ae4d643d4ab8db1354a17cced6 /src/makefile | |
parent | 4a65714f22a4d577bc95a699cf02e64abf39fe05 (diff) | |
download | makers-706536abe03c5cdfd73d1aa3f34f8b4d40680b79.tar.gz makers-706536abe03c5cdfd73d1aa3f34f8b4d40680b79.zip |
...but don't do that if the command line is more than just the one thing
Diffstat (limited to 'src/makefile')
-rw-r--r-- | src/makefile/command_line.rs | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/makefile/command_line.rs b/src/makefile/command_line.rs index 45ac181..7d4915d 100644 --- a/src/makefile/command_line.rs +++ b/src/makefile/command_line.rs @@ -88,18 +88,27 @@ impl CommandLine { }); log::trace!("executing {}", &self.execution_line); let execution_line = file.expand_macros(&self.execution_line, Some(target))?; - // unfortunately, if we had a multiline macro somewhere with non-escaped newlines, now we have to run each of them as separate lines - lazy_static! { - static ref UNESCAPED_NEWLINE: Regex = Regex::new(r"([^\\])\n").unwrap(); - } - if UNESCAPED_NEWLINE.is_match(&execution_line) { - let lines = UNESCAPED_NEWLINE - .split(&execution_line) - .map(|x| Self::from(TokenString::text(x.trim_start()))); - for line in lines { - line.execute(file, target)?; + #[cfg(feature = "full")] + { + let is_just_one_macro_expansion = self.execution_line.tokens().count() == 1 + && self.execution_line.tokens().all(|x| match x { + Token::MacroExpansion { .. } => true, + Token::FunctionCall { .. } => true, + _ => false, + }); + // unfortunately, if we had a multiline macro somewhere with non-escaped newlines, now we have to run each of them as separate lines + lazy_static! { + static ref UNESCAPED_NEWLINE: Regex = Regex::new(r"([^\\])\n").unwrap(); + } + if is_just_one_macro_expansion && UNESCAPED_NEWLINE.is_match(&execution_line) { + let lines = UNESCAPED_NEWLINE + .split(&execution_line) + .map(|x| Self::from(TokenString::text(x.trim_start()))); + for line in lines { + line.execute(file, target)?; + } + return Ok(()); } - return Ok(()); } log::trace!("executing {}", &execution_line); let mut self_ignore_errors = self.ignore_errors; |