diff options
-rw-r--r-- | build2/b.cxx | 5 | ||||
-rw-r--r-- | build2/context.cxx | 4 | ||||
-rw-r--r-- | build2/context.hxx | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index 6921a97..b73a0d6 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -596,6 +596,11 @@ main (int argc, char* argv[]) } } + // Expose eraly so can be used during bootstrap (with the same + // limitations as for pre-processing). + // + global_scope->rw ().assign (var_build_meta_operation) = mname; + for (auto oit (opspecs.begin ()); oit != opspecs.end (); ++oit) { opspec& os (*oit); diff --git a/build2/context.cxx b/build2/context.cxx index 2ebe163..b4e5160 100644 --- a/build2/context.cxx +++ b/build2/context.cxx @@ -343,6 +343,8 @@ namespace build2 const char var_extension[10] = "extension"; + const variable* var_build_meta_operation; + string current_mname; string current_oname; @@ -703,6 +705,8 @@ namespace build2 // gs.target_vars[exe::static_type]["*"].assign (var_backlink) = true; gs.target_vars[doc::static_type]["*"].assign (var_backlink) = true; + + var_build_meta_operation = &vp.insert<string> ("build.meta_operation"); } // Register builtin rules. diff --git a/build2/context.hxx b/build2/context.hxx index 378c6c0..68faa9b 100644 --- a/build2/context.hxx +++ b/build2/context.hxx @@ -281,6 +281,10 @@ namespace build2 extern const char var_extension[10]; // "extension" + // The build.* namespace. + // + extern const variable* var_build_meta_operation; // .meta_operation + // Current action (meta/operation). // // The names unlike info are available during boot but may not yet be @@ -324,7 +328,12 @@ namespace build2 inline void set_current_mif (const meta_operation_info& mif) { - current_mname = mif.name; + if (current_mname != mif.name) + { + current_mname = mif.name; + global_scope->rw ().assign (var_build_meta_operation) = mif.name; + } + current_mif = &mif; current_on = 0; // Reset. } |