aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/args.rs35
-rw-r--r--src/main.rs2
2 files changed, 36 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs
index 6def229..9318202 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -190,6 +190,41 @@ impl Args {
.map(AsRef::as_ref)
.filter(|x: &&str| x.contains('='))
}
+
+ pub fn makeflags(&self) -> String {
+ let mut result = String::new();
+ if self.environment_overrides {
+ result.push('e');
+ }
+ if self.ignore_errors {
+ result.push('i');
+ }
+ if self.keep_going {
+ result.push('k');
+ }
+ if self.dry_run {
+ result.push('n');
+ }
+ if self.print_everything {
+ result.push('p');
+ }
+ if self.question {
+ result.push('q');
+ }
+ if self.no_builtin_rules {
+ result.push('r');
+ }
+ if self.no_keep_going {
+ result.push('S');
+ }
+ if self.silent {
+ result.push('s');
+ }
+ if self.touch {
+ result.push('t');
+ }
+ result
+ }
}
#[cfg(test)]
diff --git a/src/main.rs b/src/main.rs
index e0deecc..f5d28b1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -60,7 +60,7 @@ fn main() -> Result<()> {
args.makefile = vec![default_makefile.into()];
}
// Read in the makefile(s) specified.
- // TODO dump command-line args into MAKEFLAGS
+ env::set_var("MAKEFLAGS", args.makeflags());
// TODO dump command-line macros into environment
// TODO add SHELL macro
let mut makefile = Makefile::new(&args);