Commit 42cd23d8 authored by jan.koester's avatar jan.koester
Browse files

export

parent 5c6a6f73
Loading
Loading
Loading
Loading
+3 −0
Changes for executor.cpp: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -255,6 +255,9 @@ 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) {
+8 −1
Changes for main.cpp: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -39,10 +39,17 @@ static void setup_defaults(makeplus::Makefile& mf, const char* argv0) {
            mf.variables[name] = {value, makeplus::VarFlavor::Simple, false};
        }
    };
    // GNU make's built-in CPP/CXX recipes reference other variables ($(CC)),
    // so they must be *recursive* (expanded at use time), not simple.
    auto set_default_recursive = [&](const std::string& name, const std::string& value) {
        if (mf.variables.find(name) == mf.variables.end()) {
            mf.variables[name] = {value, makeplus::VarFlavor::Recursive, false};
        }
    };

    set_default("CC", "cc");
    set_default("CXX", "clang++");
    set_default("CPP", "$(CC) -E");
    set_default_recursive("CPP", "$(CC) -E");
    set_default("AR", "ar");
    set_default("AS", "as");
    set_default("LD", "ld");