aboutsummaryrefslogtreecommitdiff
path: root/src/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile')
-rw-r--r--src/makefile/input.rs21
-rw-r--r--src/makefile/target.rs4
2 files changed, 21 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(());
diff --git a/src/makefile/target.rs b/src/makefile/target.rs
index e106c54..9f81802 100644
--- a/src/makefile/target.rs
+++ b/src/makefile/target.rs
@@ -152,6 +152,10 @@ impl StaticTargetSet {
self.data.insert(target.name.clone(), target);
}
}
+
+ pub fn has(&self, name: &str) -> bool {
+ self.data.contains_key(name)
+ }
}
impl From<StaticTargetSet> for HashMap<String, Target> {