From 68db8d315e3ef67c608cb2eddca16fd5e5fddccb Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 4 Apr 2021 12:01:03 -0600 Subject: logging! --- src/makefile/input.rs | 5 +++++ src/makefile/mod.rs | 7 +++++++ src/makefile/target.rs | 11 +++++++++++ 3 files changed, 23 insertions(+) (limited to 'src/makefile') diff --git a/src/makefile/input.rs b/src/makefile/input.rs index d6f6254..6ee5392 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -413,6 +413,11 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { inference_match.name("s2").unwrap().as_str().to_owned(), commands, ); + log::trace!( + "suffix-based inference rule defined by {:?} - {:?}", + &inference_match, + &new_rule, + ); self.inference_rules.retain(|existing_rule| { (&existing_rule.prerequisites, &existing_rule.products) diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index e13ecff..0f8cfd2 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -153,9 +153,16 @@ impl<'a> Makefile<'a> { .chain(self.builtin_inference_rules.iter()) .filter(|rule| rule.matches(name).unwrap_or(false)); for rule in inference_rule_candidates { + log::trace!( + "{:>58} considering rule to build {:?} from {:?}", + name, + &rule.products, + &rule.prerequisites + ); // whose prerequisite file ($*.s2) exists. let prereq_paths = rule .prereqs(name)? + .inspect(|x| log::trace!("{:>58} prereq {}", name, x)) .map(|prereq_path_name| { if name == prereq_path_name { // we can't build this based on itself! fuck outta here diff --git a/src/makefile/target.rs b/src/makefile/target.rs index ad46884..1c382d0 100644 --- a/src/makefile/target.rs +++ b/src/makefile/target.rs @@ -53,6 +53,12 @@ impl Target { .and_then(|t| self.newer_than(&t.borrow())) .unwrap_or(false) }); + log::trace!( + "{:>50} exists: {}, newer than dependencies: {}", + self.name, + exists, + newer_than_all_dependencies + ); exists && newer_than_all_dependencies } @@ -62,6 +68,10 @@ impl Target { .wrap_err_with(|| format!("as a dependency for target {}", self.name))?; } if !self.is_up_to_date(file) { + log::debug!("rebuilding {}...", self.name); + if self.commands.is_empty() { + log::warn!("no commands found to rebuild {}", self.name); + } self.execute_commands(file) .wrap_err_with(|| format!("while updating target {}", self.name))?; } @@ -72,6 +82,7 @@ impl Target { fn execute_commands(&self, file: &Makefile) -> Result<()> { for command in &self.commands { + log::trace!(" executing {}", command); command.execute(file, self)?; } -- cgit v1.2.3