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

test

parent f2326f81
Loading
Loading
Loading
Loading
+8 −0
Changes for parser.cpp: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -118,6 +118,14 @@ bool Parser::parse_file(const std::string& filepath, Makefile& mf) {
    mf.base_dir = fs::path(filepath).parent_path().string();
    if (mf.base_dir.empty()) mf.base_dir = ".";

    // Track MAKEFILE_LIST so makefiles can compute their own path
    // (this-makefile := $(lastword $(MAKEFILE_LIST))), as Kbuild does.
    {
        auto& ml = mf.variables["MAKEFILE_LIST"];
        ml.value += (ml.value.empty() ? "" : " ") + filepath;
        ml.flavor = VarFlavor::Simple;
    }

    std::string content((std::istreambuf_iterator<char>(file)),
                         std::istreambuf_iterator<char>());
    return parse_string(content, mf);