diff options
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r-- | src/makefile/input.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 2879b63..74742f9 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -614,6 +614,22 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { #[cfg(feature = "full")] Some(&mut deferred_eval_context), )?; + // https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html + // this is supposed to be deferred but maybe i can get away with this + // TODO move this to run at runtime + #[cfg(feature = "full")] + let prerequisites = if self.targets.has(".SECONDEXPANSION") { + self.stack + .with_scope(&self.macros) + .with_scope(&LookupInternal::new_partial(&targets)) + .expand( + &prerequisites.parse()?, + #[cfg(feature = "full")] + Some(&mut deferred_eval_context), + )? + } else { + prerequisites + }; #[cfg(feature = "full")] for child in deferred_eval_context { self.extend(child); @@ -693,10 +709,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { } } } else { - log::debug!( - "pattern-based inference rule defined: {:?}", - &new_rule, - ); + log::debug!("pattern-based inference rule defined: {:?}", &new_rule,); self.inference_rules.put(new_rule); } return Ok(()); |