From 18c80339a728dadaec94b3918eb58c7def68462d Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Fri, 26 Mar 2021 21:06:26 -0600 Subject: add & remove leading dots in extensions --- src/makefile/mod.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/makefile') diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index f38815d..bd8838a 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -36,7 +36,7 @@ impl fmt::Display for InferenceRule { } } -#[derive(PartialEq, Eq, Clone)] +#[derive(PartialEq, Eq, Clone, Debug)] pub struct Target { name: String, prerequisites: Vec, @@ -161,11 +161,6 @@ impl CommandLine { let execution_line = file.expand_macros(&self.execution_line, Some(target)); - let avoid_execution = file.args.dry_run || file.args.question || file.args.touch; - if avoid_execution && !self.always_execute { - return; - } - if !silent { println!("{}", execution_line); } @@ -549,7 +544,7 @@ impl Makefile { if !targets.contains_key(name) || exists_but_infer_anyway { // When no target rule is found to update a target, the inference rules shall // be checked. The suffix of the target to be built... - let suffix = Path::new(name).extension().map_or_else(String::new, |ext| ext.to_string_lossy().into()); + let suffix = Path::new(name).extension().map_or_else(String::new, |ext| format!(".{}", ext.to_string_lossy())); // is compared to the list of suffixes specified by the .SUFFIXES special // targets. If the .s1 suffix is found in .SUFFIXES... if self.special_target_has_prereq(".SUFFIXES", &suffix) || suffix.is_empty() { @@ -558,7 +553,7 @@ impl Makefile { // for the first .s2.s1 rule... if rule.product == suffix { // whose prerequisite file ($*.s2) exists. - let prereq_path = Path::new(name).with_extension(rule.prereq.clone()); + let prereq_path = Path::new(name).with_extension(rule.prereq.trim_start_matches('.')); let prereq_path_options = if prereq_path.is_absolute() { vec![prereq_path] } else { -- cgit v1.2.3