aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/inference_rules.rs
diff options
context:
space:
mode:
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(())
+ }
+}