diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/makefile/input.rs | 31 | 
1 files changed, 30 insertions, 1 deletions
| diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 9c895e1..460a8a0 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -474,6 +474,16 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {          let (targets, not_targets) = line_tokens              .split_once(':')              .ok_or_else(|| eyre!("read_rule couldn't find a ':' on line {}", line_number))?; +        #[cfg(feature = "full")] +        let (static_targets, targets, not_targets) = if not_targets.contains_text(":") { +            // ugh, this is probably a Static Pattern Rule +            let (pattern, not_targets) = not_targets +                .split_once(':') +                .ok_or_else(|| eyre!("bro hold the fuck up it literally just had that"))?; +            (Some(targets), pattern, not_targets) +        } else { +            (None, targets, not_targets) +        };          let targets = self.expand_macros(&targets)?;          let targets = targets.split_whitespace().collect::<Vec<_>>();          let (prerequisites, mut commands) = match not_targets.split_once(';') { @@ -534,7 +544,26 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> {                  commands,              }; -            self.inference_rules.push(new_rule); +            if let Some(static_targets) = static_targets { +                let static_targets = self.expand_macros(&static_targets)?; +                let static_targets = static_targets.split_whitespace(); +                for real_target in static_targets { +                    if new_rule.matches(real_target)? { +                        let new_target = Target { +                            name: real_target.to_owned(), +                            prerequisites: new_rule.prereqs(real_target)?.collect(), +                            commands: new_rule.commands.clone(), +                            stem: new_rule +                                .first_match(real_target)? +                                .and_then(|x| x.get(1).map(|x| x.as_str().to_owned())), +                            already_updated: Cell::new(false), +                        }; +                        self.targets.insert(real_target.to_owned(), new_target); +                    } +                } +            } else { +                self.inference_rules.push(new_rule); +            }              return Ok(());          } |