aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/inference_rules.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-27 15:50:39 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-27 15:50:39 -0600
commit028e1a631629c7f5959e522dee80188ea7534d8f (patch)
tree65aff918fdcb2999cde604a8959f2c6ec83f6f98 /src/makefile/inference_rules.rs
parent4a3bf997b83e3cf3496622ce1554c8641e6031da (diff)
downloadmakers-028e1a631629c7f5959e522dee80188ea7534d8f.tar.gz
makers-028e1a631629c7f5959e522dee80188ea7534d8f.zip
refactor makefile elements into submodules
Diffstat (limited to 'src/makefile/inference_rules.rs')
-rw-r--r--src/makefile/inference_rules.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/makefile/inference_rules.rs b/src/makefile/inference_rules.rs
new file mode 100644
index 0000000..3d18730
--- /dev/null
+++ b/src/makefile/inference_rules.rs
@@ -0,0 +1,22 @@
+use std::fmt;
+
+use crate::makefile::command_line::CommandLine;
+
+#[derive(PartialEq, Eq, Clone, Debug)]
+pub struct InferenceRule {
+ /// POSIX calls this ".s1" but that's not useful.
+ pub product: String,
+ /// POSIX calls this ".s2" but that's not useful.
+ pub prereq: String,
+ pub commands: Vec<CommandLine>,
+}
+
+impl fmt::Display for InferenceRule {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ writeln!(f, "{}{}:", &self.prereq, &self.product)?;
+ for command in &self.commands {
+ writeln!(f, "\t{}", command)?;
+ }
+ Ok(())
+ }
+}