aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-04 12:01:03 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-04 12:01:03 -0600
commit68db8d315e3ef67c608cb2eddca16fd5e5fddccb (patch)
tree93173d0093cc51b3387297dd178068918cc1c569 /src
parent6a8a04c0762e9d0c1ee357973486015a2522672d (diff)
downloadmakers-68db8d315e3ef67c608cb2eddca16fd5e5fddccb.tar.gz
makers-68db8d315e3ef67c608cb2eddca16fd5e5fddccb.zip
logging!
Diffstat (limited to 'src')
-rw-r--r--src/main.rs1
-rw-r--r--src/makefile/input.rs5
-rw-r--r--src/makefile/mod.rs7
-rw-r--r--src/makefile/target.rs11
4 files changed, 24 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index ceeb0cf..58d3cba 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -40,6 +40,7 @@ const DEFAULT_PATHS: &[&str] = &[
];
fn main() -> Result<()> {
+ env_logger::init();
jane_eyre::install()?;
let mut args = Args::from_env_and_args();
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)?;
}