From dfb51bfebd0d5c22e82d2a73412a19c3e0599524 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 11 Nov 2024 17:20:54 -0700 Subject: remember the posix mode i should either delete or overhaul that at some point --- src/makefile/input.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 9fdcf6a..2c4a6bb 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -981,6 +981,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { let name = name.trim(); value.trim_start(); + #[cfg(feature = "full")] let value = if expand_value { TokenString::text( self.expand_macros(&value) @@ -1016,13 +1017,17 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { Some(ItemSource::CommandLineOrMakeflags) => true, // We let environment variables override macros from the file only if the command-line argument to do that was given Some(ItemSource::Environment) => self.args.environment_overrides, + #[cfg(feature = "full")] Some(_) => macro_assignment.skip_if_defined, + #[cfg(not(feature = "full"))] + Some(_) => false, None => false, }; if skipped { None } else { Some(match stack.get(¯o_assignment.name) { + #[cfg(feature = "full")] Some(old_value) if macro_assignment.append => { MacroAssignmentOutcome::AppendedTo(old_value.into_owned()) } @@ -1039,18 +1044,17 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { ) -> Result<(String, Macro)> { match outcome { MacroAssignmentOutcome::AppendedTo(mut old_value) => { + let value = macro_assignment.value; #[cfg(feature = "full")] let value = if old_value.eagerly_expanded { - TokenString::text(self.expand_macros(¯o_assignment.value).wrap_err_with( - || { - format!( - "while defining {} on line {}", - macro_assignment.name, line_number - ) - }, - )?) + TokenString::text(self.expand_macros(&value).wrap_err_with(|| { + format!( + "while defining {} on line {}", + macro_assignment.name, line_number + ) + })?) } else { - macro_assignment.value + value }; old_value.text.extend(TokenString::text(" ")); old_value.text.extend(value); -- cgit v1.2.3