diff options
-rw-r--r-- | libbuild2/rule.cxx | 10 | ||||
-rw-r--r-- | libbuild2/rule.hxx | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index d5d6661..9df5f67 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -667,7 +667,7 @@ namespace build2 if ((impl = this->impl.load (memory_order_relaxed)) != nullptr) break; - using create_function = cxx_rule* (const location&); + using create_function = cxx_rule* (const location&, target_state); using load_function = create_function* (); // The only way to guarantee that the name of our module matches its @@ -888,9 +888,9 @@ namespace build2 // user-defined. // ofs << " static cxx_rule*" << '\n' - << " create_" << id << " (const location& l)" << '\n' + << " create_" << id << " (const location& l, target_state s)" << '\n' << " {" << '\n' - << " return new rule (l);" << '\n' + << " return new rule (l, s);" << '\n' << " }" << '\n' << '\n'; @@ -920,7 +920,7 @@ namespace build2 << "#ifdef _WIN32" << '\n' << "__declspec(dllexport)" << '\n' << "#endif" << '\n' - << "cxx_rule* (*" << sym << " ()) (const location&)" << '\n' + << "cxx_rule* (*" << sym << " ()) (const location&, target_state)" << '\n' << "{" << '\n' << " return &rule_" << id << "::create_" << id << ";" << '\n' << "}" << '\n' @@ -1098,7 +1098,7 @@ namespace build2 load_function* lf (function_cast<load_function*> (hs.second)); create_function* cf (lf ()); - impl = cf (loc); + impl = cf (loc, l->executed_state (perform_update_id)); this->impl.store (impl, memory_order_relaxed); // Still in load phase. } } diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx index a3d54e7..50ed126 100644 --- a/libbuild2/rule.hxx +++ b/libbuild2/rule.hxx @@ -199,10 +199,17 @@ namespace build2 class LIBBUILD2_SYMEXPORT cxx_rule: public rule { public: - const location loc; // Buildfile location of the recipe. - explicit - cxx_rule (const location& l): loc (l) {} + // A robust recipe may want to incorporate the recipe_state into its + // up-to-date decision as if the recipe library was a prerequisite (it + // cannot be injected as a real prerequisite since it's from a different + // build context). + // + const location recipe_loc; // Buildfile location of the recipe. + const target_state recipe_state; // State of recipe library target. + + cxx_rule (const location& l, target_state s) + : recipe_loc (l), recipe_state (s) {} // Return true by default. // |