Commit 27668684 authored by jan.koester's avatar jan.koester
Browse files

test

parent ab615675
Loading
Loading
Loading
Loading
+0 −33
Changes for executor.cpp: 0 added lines, 33 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
#include <algorithm>
#include <cstdlib>
#include <sys/wait.h>
#include <unistd.h>

namespace fs = std::filesystem;
using namespace makeplus;
@@ -255,9 +254,6 @@ void Executor::apply_exports(const Makefile& mf) {
    auto export_one = [&](const std::string& name, const Variable& var) {
        std::string val = (var.flavor == VarFlavor::Recursive)
            ? parser_.expand(var.value, mf) : var.value;
        if (std::getenv("MP_DBG") && name == "KBUILD_AFLAGS")
            std::cerr << "[EXP pid=" << getpid() << "] KBUILD_AFLAGS flavor="
                      << (int)var.flavor << " val=[" << val << "]\n";
        setenv(name.c_str(), val.c_str(), 1);
    };
    if (mf.export_all) {
@@ -339,12 +335,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;
    }
    if (std::getenv("MP_DBG2") && target.find("system_call.o") != std::string::npos) {
        std::cerr << "[SCOPE pid=" << getpid() << "] target=" << target
                  << " scope.size=" << scope.size() << "\n";
        for (auto& kv : scope)
            std::cerr << "   [" << kv.first << "]=[" << kv.second << "]\n";
    }
    // Export marked variables into the environment so recipes and any
    // recursive sub-makes ($(MAKE)) inherit them.
    apply_exports(*mfp);
@@ -362,9 +352,6 @@ 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);
        if (std::getenv("MP_DBG") && target == ".")
            std::cerr << "[REC pid=" << getpid() << "] target=. recipe=[" << recipe
                      << "] expanded=[" << expanded << "]\n";
        // 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.
@@ -426,26 +413,6 @@ int Executor::build_sequential(const std::string& target_in,
    std::string stem;
    const Rule* rule = find_rule(target, stem);

    if (std::getenv("MP_DBG") && (target == "." || target == "built-in.a")) {
        std::cerr << "[DBG pid=" << getpid() << "] target=[" << target << "] rule=" << (rule?"Y":"N")
                  << " recipes=" << (rule?rule->recipes.size():0)
                  << " phony=" << mf_.phony_targets.count(target) << std::endl;
        int idx = 0;
        for (auto& rr : mf_.rules) {
            for (auto& tt : rr.targets) {
                if (tt == target) {
                    std::cerr << "   rule#" << idx << " targets=" << rr.targets.size()
                              << " prereqs=" << rr.prerequisites.size()
                              << " recipes=" << rr.recipes.size()
                              << " pat=" << rr.is_pattern << " [";
                    for (auto& rc : rr.recipes) std::cerr << rc << " | ";
                    std::cerr << "]\n";
                }
            }
            idx++;
        }
    }

    if (!rule) {
        if (file_exists(target)) return 0;
        // A target declared .PHONY but lacking any rule/recipe (e.g. Kbuild's
+0 −3
Changes for parser.cpp: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
#include <cstdio>
#include <cstring>
#include <cctype>
#include <unistd.h>

namespace fs = std::filesystem;
using namespace makeplus;
@@ -247,8 +246,6 @@ bool Parser::handle_conditional(const std::string& line_in, Makefile& mf) {
        }
        bool cond = eval_if_directive(line, mf);
        cond_stack_.push_back({cond, cond});
        if (std::getenv("MP_DBG") && line.find("need-sub-make),1") != std::string::npos)
            std::cerr << "[CD pid=" << getpid() << "] if [" << line.substr(0, 50) << "] cond=" << cond << " -> depth=" << cond_stack_.size() << "\n";
        return true;
    }