aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/makefile/input.rs22
-rw-r--r--tests/conditional_assignment_inheritance.rs3
-rw-r--r--tests/rule_specific_macros.rs5
3 files changed, 17 insertions, 13 deletions
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(&macro_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(&macro_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);
diff --git a/tests/conditional_assignment_inheritance.rs b/tests/conditional_assignment_inheritance.rs
index cb7e806..24f0533 100644
--- a/tests/conditional_assignment_inheritance.rs
+++ b/tests/conditional_assignment_inheritance.rs
@@ -1,10 +1,11 @@
+#![cfg(feature = "full")]
+
mod utils;
use std::fs;
use utils::{make, R};
#[test]
-#[cfg(feature = "full")]
fn conditional_assignment_inheritance_test() -> R {
let dir = tempfile::tempdir()?;
diff --git a/tests/rule_specific_macros.rs b/tests/rule_specific_macros.rs
index 8cc9c12..34e7e77 100644
--- a/tests/rule_specific_macros.rs
+++ b/tests/rule_specific_macros.rs
@@ -1,10 +1,11 @@
+#![cfg(feature = "full")]
+
mod utils;
use std::fs;
use utils::{make, R};
#[test]
-#[cfg(feature = "full")]
fn target_specific_macros() -> R {
let dir = tempfile::tempdir()?;
@@ -26,7 +27,6 @@ foo.h:
#[test]
#[ignore = "not yet implemented"]
-#[cfg(feature = "full")]
fn target_specific_macros_inherited() -> R {
let dir = tempfile::tempdir()?;
@@ -54,7 +54,6 @@ prog : prog.o foo.o bar.o
#[test]
#[ignore = "not yet implemented"]
-#[cfg(feature = "full")]
fn inference_rule_specific_macros() -> R {
let dir = tempfile::tempdir()?;