summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorMura Li <github@ctli.io>2019-10-21 20:08:16 +0800
committerMura Li <github@ctli.io>2019-10-22 09:46:20 +0800
commit21422e62f15776a5abf3bf16e8416ffa9f8771fc (patch)
tree3aecb07e40c67f739c4c7a8610b4c3bda76c1289 /mbld
parent3450935eec9aa87ac23f8b6524a2c9a873105041 (diff)
downloadmc-21422e62f15776a5abf3bf16e8416ffa9f8771fc.tar.gz
Support cli arguments for mbld -R
Example: mbld -R main.myr arg1 arg2 arg3
Diffstat (limited to 'mbld')
-rw-r--r--mbld/main.myr14
1 files changed, 11 insertions, 3 deletions
diff --git a/mbld/main.myr b/mbld/main.myr
index fb5e018..4d40266 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -14,7 +14,7 @@ use "util"
use "syssel"
const main = {args : byte[:][:]
- var b, runsrc, objdir, path, cmd
+ var b, runsrc, objdir, path, cmd, srcs
var targname, tags, pid, ok
cmd = std.optparse(args, &[
@@ -75,15 +75,23 @@ const main = {args : byte[:][:]
std.setenv(e, v)
;;
+ std.put("cmd.args: {}\n", cmd.args)
b = mkbuild(tags)
if targname.len != 0
if cmd.args.len == 0
std.fatal("nothing to compile\n")
;;
+
+ if runsrc
+ srcs = cmd.args[0:1]
+ else
+ srcs = cmd.args
+ ;;
+
bld.opt_objdir = objdir
- ok = buildimm(b, targname, cmd.args)
+ ok = buildimm(b, targname, srcs)
if runsrc && ok
- pid = runcmd(targname, cmd.args)
+ pid = runcmd(targname, cmd.args[1:])
match std.wait(pid)
| `std.Wsuccess: ok = true
| _: ok = false