Commit 5657cf56 authored by jan.koester's avatar jan.koester
Browse files

test

parent ea1e44aa
Loading
Loading
Loading
Loading
+10 −1
Changes for parser.cpp: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -585,7 +585,16 @@ bool Parser::try_parse_assignment(const std::string& line, Makefile& mf) {
            auto it = mf.variables.find(name);
            if (it != mf.variables.end()) {
                if (!it->second.from_cmdline) {
                    it->second.value += " " + value;
                    // GNU make: when '+=' appends to a simply-expanded (':=')
                    // variable, the appended text is expanded immediately;
                    // for a recursive variable it is stored verbatim. Without
                    // this, e.g. "KBUILD_VMLINUX_OBJS += $(patsubst ...)" left
                    // raw "$(patsubst ...)" in a ':=' value, later splitting
                    // into bogus rule targets.
                    std::string appended = (it->second.flavor == VarFlavor::Simple)
                        ? expand(value, mf) : value;
                    if (it->second.value.empty()) it->second.value = appended;
                    else it->second.value += " " + appended;
                }
            } else {
                mf.variables[name] = {value, VarFlavor::Recursive, false};
+3 −0
Changes for parser.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ private:
    bool try_parse_rule(const std::string& line, Makefile& mf, Rule*& current_rule);
    void handle_include(const std::string& args, Makefile& mf, bool optional);
    bool handle_conditional(const std::string& line, Makefile& mf);
    // Evaluate a single 'ifeq/ifneq/ifdef/ifndef ...' directive to a boolean.
    // Shared by the initial 'if...' handling and the 'else if...' chain.
    bool eval_if_directive(const std::string& directive, Makefile& mf);

    std::string do_expand(const std::string& input, const Makefile& mf,
                           const std::map<std::string, std::string>* auto_vars) const;