Commit 86e7524c authored by jan.koester's avatar jan.koester
Browse files

test

parent 395fcd97
Loading
Loading
Loading
Loading
+2 −1
Changes for executor.cpp: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -612,9 +612,10 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
        newer = prereqs;
    }

    auto order_only = expand_order_only(target, rule, stem);
    for (const auto& recipe : rule->recipes) {
        std::string expanded = parser_.expand_with_automatic(
            recipe, *mfp, target, first_prereq, prereqs, newer, stem);
            recipe, *mfp, target, first_prereq, prereqs, newer, stem, &order_only);
        // A recipe line may expand (e.g. via a canned 'define' sequence) into
        // several physical lines. GNU make runs each as its own command with
        // independent @/-/+ prefix handling and its own shell.
+14 −1
Changes for parser.cpp: 14 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1194,7 +1194,8 @@ std::string Parser::expand_with_automatic(const std::string& input, const Makefi
                                            const std::string& first_prereq,
                                            const std::vector<std::string>& all_prereqs,
                                            const std::vector<std::string>& newer_prereqs,
                                            const std::string& stem) const {
                                            const std::string& stem,
                                            const std::vector<std::string>* order_only) const {
    std::map<std::string, std::string> auto_vars;
    auto_vars["@"] = target;
    auto_vars["<"] = first_prereq;
@@ -1234,6 +1235,18 @@ std::string Parser::expand_with_automatic(const std::string& input, const Makefi
    auto_vars["?"] = newer_p;
    auto_vars["*"] = stem;

    // '$|': the order-only prerequisites, duplicates removed like '$^'
    std::string oo;
    if (order_only) {
        std::set<std::string> seen;
        for (const auto& p : *order_only) {
            if (!seen.insert(p).second) continue;
            if (!oo.empty()) oo += ' ';
            oo += p;
        }
    }
    auto_vars["|"] = oo;

    fs::path tp(target);
    auto_vars["@D"] = tp.parent_path().empty() ? "." : tp.parent_path().string();
    auto_vars["@F"] = tp.filename().string();
+2 −1
Changes for parser.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -96,7 +96,8 @@ public:
                                       const std::string& first_prereq,
                                       const std::vector<std::string>& all_prereqs,
                                       const std::vector<std::string>& newer_prereqs,
                                       const std::string& stem) const;
                                       const std::string& stem,
                                       const std::vector<std::string>* order_only = nullptr) const;

    const std::string& error() const { return error_; }