aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/inference_rules.rs
blob: 3d18730243df68b818d0da6a064e02ff20e1214d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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(())
    }
}