diff options
Diffstat (limited to 'src/makefile/mod.rs')
-rw-r--r-- | src/makefile/mod.rs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index 308d25d..aab5054 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -25,7 +25,7 @@ use command_line::CommandLine; use inference_rules::InferenceRule; use input::FinishedMakefileReader; pub use input::MakefileReader; -use r#macro::{Set as MacroSet, Source as MacroSource}; +use r#macro::{Macro, Set as MacroSet, Source as MacroSource}; use target::Target; use token::TokenString; @@ -62,8 +62,12 @@ impl<'a> Makefile<'a> { if let [name, value] = *r#macro.splitn(2, '=').collect::<Vec<_>>() { macros.set( name.into(), - MacroSource::CommandLineOrMakeflags, - TokenString::text(value), + Macro { + source: MacroSource::CommandLineOrMakeflags, + text: TokenString::text(value), + #[cfg(feature = "full")] + eagerly_expanded: false, + }, ); } } @@ -73,15 +77,23 @@ impl<'a> Makefile<'a> { let make_cmd_goals = args.targets().collect::<Vec<_>>(); macros.set( "MAKECMDGOALS".to_owned(), - MacroSource::Builtin, - TokenString::text(make_cmd_goals.join(" ")), + Macro { + source: MacroSource::Builtin, + text: TokenString::text(make_cmd_goals.join(" ")), + #[cfg(feature = "full")] + eagerly_expanded: false, + }, ); if let Ok(curdir) = env::current_dir() { macros.set( "CURDIR".to_owned(), - MacroSource::Builtin, - TokenString::text(curdir.to_string_lossy()), + Macro { + source: MacroSource::Builtin, + text: TokenString::text(curdir.to_string_lossy()), + #[cfg(feature = "full")] + eagerly_expanded: false, + }, ); } } @@ -135,8 +147,8 @@ impl<'a> Makefile<'a> { let follow_gnu = cfg!(feature = "full"); let vpath_options = match self.macros.get("VPATH") { - Some((_, vpath)) if follow_gnu => { - let vpath = self.expand_macros(vpath, None)?; + Some(Macro { text, .. }) if follow_gnu => { + let vpath = self.expand_macros(text, None)?; env::split_paths(&vpath).collect() } _ => vec![], |