Loading executor.cpp +15 −0 Changes for executor.cpp: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -958,6 +958,21 @@ int Executor::build_parallel(const std::vector<std::string>& targets) { int Executor::build(const std::vector<std::string>& targets) { std::vector<std::string> actual_targets = targets; if (actual_targets.empty()) { // ".DEFAULT_GOAL := all" (GNU make's documented form, a variable // that may be set anywhere, e.g. after the first rule) overrides // the first target auto dg = mf_.variables.find(".DEFAULT_GOAL"); if (dg != mf_.variables.end()) { std::string val = (dg->second.flavor == VarFlavor::Recursive) ? parser_.expand(dg->second.value, mf_) : dg->second.value; size_t b = val.find_first_not_of(" \t"); if (b != std::string::npos) { size_t e = val.find_first_of(" \t", b); actual_targets.push_back(val.substr(b, e == std::string::npos ? e : e - b)); } } } if (actual_targets.empty()) { if (mf_.default_target.empty()) { std::cerr << "makeplus: *** No targets. Stop." << std::endl; Loading parser.cpp +11 −1 Changes for parser.cpp: 11 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -895,11 +895,21 @@ bool Parser::try_parse_rule(const std::string& line, Makefile& mf, Rule*& curren std::string tpat = normalize_target(expand(trim(rhs_raw.substr(0, c2)), mf)); std::string ppat = expand(trim(rhs_raw.substr(c2 + 1)), mf); if (tpat.find('%') != std::string::npos) { auto pprereqs = split_words(ppat); // "targets: dir/%.h: src/%.h | dir": order-only after '|' std::vector<std::string> pprereqs, poo; size_t pipe = ppat.find('|'); if (pipe != std::string::npos) { pprereqs = split_words(ppat.substr(0, pipe)); poo = split_words(ppat.substr(pipe + 1)); } else { pprereqs = split_words(ppat); } for (auto& p : pprereqs) p = normalize_target(p); for (auto& p : poo) p = normalize_target(p); Rule rule; rule.targets = targets; rule.prerequisites = pprereqs; rule.order_only_prereqs = poo; rule.is_pattern = false; rule.target_pattern = tpat; if (has_inline_recipe) rule.recipes.push_back(inline_recipe); Loading Loading
executor.cpp +15 −0 Changes for executor.cpp: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -958,6 +958,21 @@ int Executor::build_parallel(const std::vector<std::string>& targets) { int Executor::build(const std::vector<std::string>& targets) { std::vector<std::string> actual_targets = targets; if (actual_targets.empty()) { // ".DEFAULT_GOAL := all" (GNU make's documented form, a variable // that may be set anywhere, e.g. after the first rule) overrides // the first target auto dg = mf_.variables.find(".DEFAULT_GOAL"); if (dg != mf_.variables.end()) { std::string val = (dg->second.flavor == VarFlavor::Recursive) ? parser_.expand(dg->second.value, mf_) : dg->second.value; size_t b = val.find_first_not_of(" \t"); if (b != std::string::npos) { size_t e = val.find_first_of(" \t", b); actual_targets.push_back(val.substr(b, e == std::string::npos ? e : e - b)); } } } if (actual_targets.empty()) { if (mf_.default_target.empty()) { std::cerr << "makeplus: *** No targets. Stop." << std::endl; Loading
parser.cpp +11 −1 Changes for parser.cpp: 11 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -895,11 +895,21 @@ bool Parser::try_parse_rule(const std::string& line, Makefile& mf, Rule*& curren std::string tpat = normalize_target(expand(trim(rhs_raw.substr(0, c2)), mf)); std::string ppat = expand(trim(rhs_raw.substr(c2 + 1)), mf); if (tpat.find('%') != std::string::npos) { auto pprereqs = split_words(ppat); // "targets: dir/%.h: src/%.h | dir": order-only after '|' std::vector<std::string> pprereqs, poo; size_t pipe = ppat.find('|'); if (pipe != std::string::npos) { pprereqs = split_words(ppat.substr(0, pipe)); poo = split_words(ppat.substr(pipe + 1)); } else { pprereqs = split_words(ppat); } for (auto& p : pprereqs) p = normalize_target(p); for (auto& p : poo) p = normalize_target(p); Rule rule; rule.targets = targets; rule.prerequisites = pprereqs; rule.order_only_prereqs = poo; rule.is_pattern = false; rule.target_pattern = tpat; if (has_inline_recipe) rule.recipes.push_back(inline_recipe); Loading