make actions always execute regardless of files existing

master
Daniel Kolesa 2015-11-21 18:30:11 +00:00
parent b3bf83dfc5
commit 6867946e97
1 changed files with 34 additions and 34 deletions

68
main.cc
View File

@ -108,7 +108,7 @@ struct ObState {
Rule(): target(), deps(), func(nullptr), action(false) {} Rule(): target(), deps(), func(nullptr), action(false) {}
Rule(const Rule &r): target(r.target), deps(r.deps), func(r.func), Rule(const Rule &r): target(r.target), deps(r.deps), func(r.func),
action(false) { action(r.action) {
cscript::bcode_ref(func); cscript::bcode_ref(func);
} }
~Rule() { cscript::bcode_unref(func); } ~Rule() { cscript::bcode_unref(func); }
@ -200,45 +200,45 @@ struct ObState {
int ret = wait_result([&rlist, &subdeps, &tname, this]() { int ret = wait_result([&rlist, &subdeps, &tname, this]() {
return exec_list(rlist, subdeps, tname); return exec_list(rlist, subdeps, tname);
}); });
if (!ret && ob_check_exec(tname, subdeps)) { Uint32 *func = nullptr;
Uint32 *func = nullptr; bool act = false;
for (auto &sr: rlist.iter()) { for (auto &sr: rlist.iter()) {
Rule &r = *sr.rule; Rule &r = *sr.rule;
if (r.func) { if (r.func) {
func = r.func; func = r.func;
break; act = r.action;
} break;
} }
if (func) { }
StackedValue targetv, sourcev, sourcesv; if ((!ret && (act || ob_check_exec(tname, subdeps))) && func) {
StackedValue targetv, sourcev, sourcesv;
targetv.id = cs.new_ident("target"); targetv.id = cs.new_ident("target");
if (!cscript::check_alias(targetv.id)) if (!cscript::check_alias(targetv.id))
return 1;
targetv.set_cstr(tname);
targetv.push();
if (subdeps.size() > 0) {
sourcev.id = cs.new_ident("source");
sourcesv.id = cs.new_ident("sources");
if (!cscript::check_alias(sourcev.id))
return 1;
if (!cscript::check_alias(sourcesv.id))
return 1; return 1;
targetv.set_cstr(tname);
targetv.push();
if (subdeps.size() > 0) { sourcev.set_cstr(subdeps[0]);
sourcev.id = cs.new_ident("source"); sourcev.push();
sourcesv.id = cs.new_ident("sources");
if (!cscript::check_alias(sourcev.id))
return 1;
if (!cscript::check_alias(sourcesv.id))
return 1;
sourcev.set_cstr(subdeps[0]); auto dsv = ostd::appender<String>();
sourcev.push(); ostd::concat(dsv, subdeps);
ostd::Size len = dsv.size();
auto dsv = ostd::appender<String>(); sourcesv.set_str(ostd::CharRange(dsv.get().disown(),
ostd::concat(dsv, subdeps); len));
ostd::Size len = dsv.size(); sourcesv.push();
sourcesv.set_str(ostd::CharRange(dsv.get().disown(),
len));
sourcesv.push();
}
return cs.run_int(func);
} }
return cs.run_int(func);
} }
return ret; return ret;
} }