diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-06 14:11:43 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-06 14:11:43 -0600 |
commit | 5a101a96ada9ddbd4be54c46cd7d0125825c2283 (patch) | |
tree | dd5b54a8b0917d53e17e9fbd31b7280669bcc0ec /src/makefile/mod.rs | |
parent | 1602ad07efa6d3c4170928537843a0d61a5cd5e7 (diff) | |
download | makers-5a101a96ada9ddbd4be54c46cd7d0125825c2283.tar.gz makers-5a101a96ada9ddbd4be54c46cd7d0125825c2283.zip |
eagerly expand when appending to eagerly-expanded macros
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![], |