include() See var_include documentation for details on what's going on here.
| 589 | // See var_include documentation for details on what's going on here. |
| 590 | // |
| 591 | include_type |
| 592 | include_impl (action a, |
| 593 | const target& t, |
| 594 | const prerequisite& p, |
| 595 | const target* m, |
| 596 | lookup* rl) |
| 597 | { |
| 598 | context& ctx (t.ctx); |
| 599 | |
| 600 | include_type r (include_type::normal); |
| 601 | { |
| 602 | lookup l (p.vars[ctx.var_include]); |
| 603 | |
| 604 | if (l.defined ()) |
| 605 | { |
| 606 | if (l->null) |
| 607 | { |
| 608 | // @@ TMP (added in 0.16.0). |
| 609 | // |
| 610 | warn << "null " << *ctx.var_include << " variable value specified " |
| 611 | << "for prerequisite " << p << |
| 612 | info << "treated as undefined for backwards compatibility" << |
| 613 | info << "this warning will become error in the future"; |
| 614 | } |
| 615 | else |
| 616 | { |
| 617 | const string& v (cast<string> (*l)); |
| 618 | |
| 619 | if (v == "false") r = include_type::excluded; |
| 620 | else if (v == "true") r = include_type::normal; |
| 621 | else if (v == "adhoc") r = include_type::adhoc; |
| 622 | else if (v == "posthoc") r = include_type::posthoc; |
| 623 | else |
| 624 | fail << "invalid " << *ctx.var_include << " variable value '" |
| 625 | << v << "' specified for prerequisite " << p; |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | // Handle operation-specific override (see var_include documentation |
| 631 | // for details). |
| 632 | // |
| 633 | lookup l; |
| 634 | optional<bool> r1; // Absent means something other than true|false. |
| 635 | |
| 636 | names storage; |
| 637 | names_view ns; |
| 638 | const variable* ovar (nullptr); |
| 639 | |
| 640 | if (r != include_type::excluded) |
| 641 | { |
| 642 | // Instead of going via potentially expensive target::base_scope(), use |
| 643 | // the prerequisite's scope; while it may not be the same as the |
| 644 | // targets's base scope, they must have the same root scope. |
| 645 | // |
| 646 | const scope& rs (*p.scope.root_scope ()); |
| 647 | |
| 648 | ovar = rs.root_extra->operations[ |