Commit 3691c799 authored by jan.koester's avatar jan.koester
Browse files

gnu func ext

parent bfcdb20a
Loading
Loading
Loading
Loading
+6 −27
Changes for executor.cpp: 6 added lines, 27 removed lines.
Original line number Diff line number Diff line
@@ -585,10 +585,6 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
                           const std::map<std::string, std::string>& scope) {
    std::string first_prereq = prereqs.empty() ? "" : prereqs[0];

    // Apply target-specific variables (recursive flavor) for this target by
    // expanding the recipes against a local override of the makefile. The
    // `scope` already contains this target's own bindings merged with those
    // inherited from ancestor targets (see compute_target_scope).
    const Makefile* mfp = &mf_;
    Makefile local_copy;
    if (!scope.empty()) {
@@ -597,9 +593,6 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
            local_copy.variables[kv.first] = {kv.second, VarFlavor::Recursive, false};
        mfp = &local_copy;
    }
    // Compute the variables to export into each recipe's child process. Passing
    // them explicitly (rather than setenv on the shared environment) keeps
    // concurrent recipes from clobbering one another's environment under -j.
    std::vector<std::string> recipe_env = collect_exports(*mfp);

    std::vector<std::string> newer;
@@ -616,33 +609,20 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
    for (const auto& recipe : rule->recipes) {
        std::string expanded = parser_.expand_with_automatic(
            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.
        std::vector<std::string> sublines;
        {
            std::string cur;
            for (char ch : expanded) {
                if (ch == '\n') { sublines.push_back(cur); cur.clear(); }
                else cur += ch;
            }
            sublines.push_back(cur);
        }

        for (auto& cmd : sublines) {
        bool is_silent = silent_;
        bool ignore_error = false;
        bool force_exec = false;

        size_t start = 0;
            while (start < cmd.size()) {
                if (cmd[start] == '@') { is_silent = true; start++; }
                else if (cmd[start] == '-') { ignore_error = true; start++; }
                else if (cmd[start] == '+') { force_exec = true; start++; }
                else if (cmd[start] == ' ' || cmd[start] == '\t') { start++; }
        while (start < expanded.size()) {
            if (expanded[start] == '@') { is_silent = true; start++; }
            else if (expanded[start] == '-') { ignore_error = true; start++; }
            else if (expanded[start] == '+') { force_exec = true; start++; }
            else if (expanded[start] == ' ' || expanded[start] == '\t') { start++; }
            else break;
        }
            cmd = cmd.substr(start);
        std::string cmd = expanded.substr(start);

        if (cmd.empty()) continue;

@@ -660,7 +640,6 @@ int Executor::execute_rule(const std::string& target, const Rule* rule,
            }
        }
    }
    }
    return 0;
}