aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r--src/makefile/input.rs30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs
index 5a937f5..0e0506a 100644
--- a/src/makefile/input.rs
+++ b/src/makefile/input.rs
@@ -18,9 +18,10 @@ use super::conditional::{Line as ConditionalLine, State as ConditionalState};
use super::inference_rules::InferenceRule;
#[cfg(feature = "full")]
use super::r#macro::ExportConfig;
-use super::r#macro::{Macro, Set as MacroSet, Source as MacroSource};
+use super::r#macro::{Macro, Set as MacroSet};
use super::target::Target;
use super::token::{tokenize, Token, TokenString};
+use super::ItemSource;
enum LineType {
Rule,
@@ -194,7 +195,7 @@ impl<'a, 'parent> MakefileReader<'a, 'parent, BufReader<File>> {
macros.set(
"MAKEFILE_LIST".to_owned(),
Macro {
- source: MacroSource::Builtin,
+ source: ItemSource::Builtin,
text: TokenString::text(path.as_ref().to_string_lossy()),
#[cfg(feature = "full")]
eagerly_expanded: false,
@@ -651,6 +652,10 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
#[cfg(feature = "full")]
if is_pattern {
let new_rule = InferenceRule {
+ source: ItemSource::File {
+ name: self.file_name.clone(),
+ line: line_number,
+ },
products: targets.into_iter().map(|x| x.to_owned()).collect(),
prerequisites,
commands,
@@ -703,6 +708,10 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
if let Some(inference_match) = inference_match {
let new_rule = InferenceRule::new_suffix(
+ ItemSource::File {
+ name: self.file_name.clone(),
+ line: line_number,
+ },
inference_match.s1.to_owned(),
inference_match.s2.to_owned(),
commands,
@@ -816,18 +825,26 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
match self.macros.get(name) {
// We always let command line or MAKEFLAGS macros override macros from the file.
Some(Macro {
- source: MacroSource::CommandLineOrMakeflags,
+ source: ItemSource::CommandLineOrMakeflags,
..
}) => return Ok(()),
// We let environment variables override macros from the file only if the command-line argument to do that was given
Some(Macro {
- source: MacroSource::Environment,
+ source: ItemSource::Environment,
..
}) if self.args.environment_overrides => return Ok(()),
Some(_) if skip_if_defined => return Ok(()),
_ => {}
}
+ log::trace!(
+ "{}:{}: setting macro {} to {}",
+ &self.file_name,
+ line_number,
+ name,
+ &value
+ );
+
let value = match self.macros.pop(name) {
Some(mut old_value) if append => {
#[cfg(feature = "full")]
@@ -843,7 +860,10 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {
old_value
}
_ => Macro {
- source: MacroSource::File,
+ source: ItemSource::File {
+ name: self.file_name.clone(),
+ line: line_number,
+ },
text: value,
#[cfg(feature = "full")]
eagerly_expanded: expand_value,