From 2a84040028851fea3c5c3ce7fbf1b76b2d280e82 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 6 Oct 2015 12:32:47 +0100 Subject: [PATCH] rule- for dep-less rule definitions --- example/cubefile | 2 +- main.cc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/example/cubefile b/example/cubefile index 1344d1b..4389e5e 100644 --- a/example/cubefile +++ b/example/cubefile @@ -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 ] diff --git a/main.cc b/main.cc index c64e877..3fab935 100644 --- a/main.cc +++ b/main.cc @@ -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) {