rule- for dep-less rule definitions

master
Daniel Kolesa 2015-10-06 12:32:47 +01:00
parent 371e8597f4
commit 2a84040028
2 changed files with 14 additions and 1 deletions

View File

@ -24,7 +24,7 @@ rule %.o %.c [
shell $CC -c -o $target $source
]
rule clean [] [
rule- clean [
echo " CLEAN" $OBJ test
shell rm -f $OBJ test
]

13
main.cc
View File

@ -394,6 +394,19 @@ int main(int argc, char **argv) {
}
});
os.cs.add_command("rule-", "seN", [](cscript::CsState &, const char *tgt,
ostd::Uint32 *body, int *numargs) {
auto targets = cscript::util::list_explode(tgt);
for (auto &target: targets.iter()) {
Rule &r = rules.push();
r.target = target;
if (*numargs > 1) {
r.func = body;
cscript::bcode_ref(body);
}
}
});
os.cs.add_command("getenv", "s", [](cscript::CsState &cs,
const char *en) {
if (ignore_env) {