diff options
| author | Melody Horn <melody@boringcactus.com> | 2024-12-16 21:47:44 -0700 | 
|---|---|---|
| committer | Melody Horn <melody@boringcactus.com> | 2024-12-16 21:47:44 -0700 | 
| commit | 2ca7f38b6d27b961919032aa675b02a9c5da73c0 (patch) | |
| tree | ebed219288c831ae64250c9364cf91851a1dedb8 /src | |
| parent | f43f5b4861492d7c3642f662b0fa2abea5c3ca5c (diff) | |
| download | makers-2ca7f38b6d27b961919032aa675b02a9c5da73c0.tar.gz makers-2ca7f38b6d27b961919032aa675b02a9c5da73c0.zip | |
retain --no-print-directory in MAKEFLAGS
Diffstat (limited to 'src')
| -rw-r--r-- | src/args.rs | 36 | 
1 files changed, 34 insertions, 2 deletions
| diff --git a/src/args.rs b/src/args.rs index f0892cb..40f591f 100644 --- a/src/args.rs +++ b/src/args.rs @@ -242,7 +242,6 @@ impl Args {          if self.touch {              flags.push('t');          } -        // TODO decide whether or not print_directory should go here too          let macros = self              .targets_or_macros @@ -257,9 +256,18 @@ impl Args {              result.push('-');          }          result.add_assign(&flags); + +        #[cfg(feature = "full")] +        if self.no_print_directory { +            if !result.is_empty() { +                result.push(' '); +            } +            result.push_str("--no-print-directory"); +        } +          // TODO consider -- to separate flags from macros - GNU does it but it would require          // gnarly splicing to not override recursive macros -        if !flags.is_empty() && !macros.is_empty() { +        if !result.is_empty() && !macros.is_empty() {              result += " ";          }          result.add_assign(¯os); @@ -528,4 +536,28 @@ mod test {          );          assert_eq!(args.makeflags(), "-einpqrSst -- baz=yeet foo=bar");      } + +    #[cfg(feature = "full")] +    #[test] +    fn makeflags_no_print_directory() { +        let args = +            Args { +                environment_overrides: false, +                makefile: vec![], +                ignore_errors: false, +                keep_going: false, +                dry_run: false, +                print_everything: false, +                question: false, +                no_builtin_rules: false, +                no_keep_going: false, +                silent: false, +                touch: false, +                directory: None, +                print_directory: false, +                no_print_directory: true, +                targets_or_macros: vec!["V=1".into()], +            }; +        assert_eq!(args.makeflags(), "--no-print-directory V=1"); +    }  } |