summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-05-03 00:20:34 -0700
committerOri Bernstein <ori@eigenstate.org>2015-05-03 00:20:34 -0700
commitb769b88bbc3e0ddcef7991e73b2582d472f08d89 (patch)
tree887c3b88a4112ad6a41ea4106c8fa5e1a7e60b4f
parentd6882e116c61b3ec3a79c29ceabbafe36196235f (diff)
downloadmc-b769b88bbc3e0ddcef7991e73b2582d472f08d89.tar.gz
Add support for 'cmd' args.
-rw-r--r--mbld/build.myr6
-rw-r--r--mbld/clean.myr6
-rw-r--r--mbld/install.myr4
-rw-r--r--mbld/parse.myr21
-rw-r--r--mbld/types.myr7
5 files changed, 28 insertions, 16 deletions
diff --git a/mbld/build.myr b/mbld/build.myr
index 65f2a81..f8a0414 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -26,7 +26,8 @@ const buildall = {b
| `Lib lt: buildlib(b, lt)
| `Test tt: /* build on 'mbld test' by default */
| `Gen gt: genfiles(b, gt)
- | `Man m: /* nothing needed */
+ | `Man mt: /* nothing needed */
+ | `Cmd ct: /* these are for manual commands */
;;
;;
-> true
@@ -49,7 +50,8 @@ const build = {b, targ
| `std.Some (`Lib lt): buildlib(b, lt)
| `std.Some (`Test tt): buildbin(b, tt, false)
| `std.Some (`Gen gt): run(gt.cmd)
- | `std.Some (`Man m): /* nothing needed */
+ | `std.Some (`Cmd ct): run(ct.cmd)
+ | `std.Some (`Man mt): /* nothing needed */
| `std.None: std.fatal(1, "invalid target %s\n", targ)
;;
-> true
diff --git a/mbld/clean.myr b/mbld/clean.myr
index c82440f..abe8956 100644
--- a/mbld/clean.myr
+++ b/mbld/clean.myr
@@ -27,7 +27,8 @@ const cleanall = {b
std.put("\tclean %s\n", f)
;;
;;
- | `Man m:
+ | `Cmd ct: /* nothing to do */
+ | `Man mt: /* nothing to do */
;;
;;
-> true
@@ -54,7 +55,8 @@ const clean = {b, targ
std.put("\tclean %s\n", f)
;;
;;
- | `Man m:
+ | `Cmd ct:
+ | `Man mt:
;;
;;
-> true
diff --git a/mbld/install.myr b/mbld/install.myr
index bc4dd27..60adaa9 100644
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -35,7 +35,9 @@ const movetargs = {b, delete
movefile(b, delete, lt.dir, libarchive, opt_instroot, opt_destdir, "lib/myr", 0o644)
std.slfree(libarchive)
| `Gen gt:
- /* nothing to do (?) */
+ /* nothing to do */
+ | `Cmd ct:
+ /* nothing to do */
| `Man mt:
/* FIXME: figure out man section by number */
for m in mt.pages
diff --git a/mbld/parse.myr b/mbld/parse.myr
index 310a276..8f02221 100644
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -169,7 +169,8 @@ const target = {b, p
| `std.Some "bin": bintarget(b, p)
| `std.Some "test": testtarget(b, p)
| `std.Some "lib": libtarget(b, p)
- | `std.Some "gen": gentarget(b, p)
+ | `std.Some "gen": cmdtarget(b, p, false)
+ | `std.Some "cmd": cmdtarget(b, p, true)
| `std.Some "man": mantarget(b, p)
| `std.Some "sub": subtarget(b, p)
| `std.Some targtype: failparse(p, "unknown targtype type %s\n", targtype)
@@ -221,9 +222,8 @@ const subtarget = {b, p
;;
}
-
/* gentarget: wordlist {attrs} = wordlist ;; */
-const gentarget = {b, p
+const cmdtarget = {b, p, isgen
var outlist, deplist, cmdlist
var durable
var attrs
@@ -232,11 +232,14 @@ const gentarget = {b, p
match wordlist(p)
| `std.None: failparse(p, "gen target missing output files\n")
| `std.Some out:
+ if isgen && out.len != 1
+ failparse(p, "gen target takes one name\n")
+ ;;
outlist = out
;;
skipspace(p)
- if matchc(p, '{')
+ if !isgen && matchc(p, '{')
match attrlist(p)
| `std.Some al: attrs = al
| `std.None: failparse(p, "invalid attr list for %s\n", outlist[0])
@@ -251,7 +254,7 @@ const gentarget = {b, p
;;
match wordlist(p)
- | `std.None: failparse(p, "gen target missing command\n")
+ | `std.None: failparse(p, "target missing command\n")
| `std.Some cmd:
cmdlist = cmd
;;
@@ -278,9 +281,11 @@ const gentarget = {b, p
.deps=deplist,
.cmd=cmdlist
])
- for o in outlist
- std.htput(b.gensrc, o, gt)
- addtarg(p, b, o, `Gen gt)
+ if !isgen
+ for o in outlist
+ std.htput(b.gensrc, o, gt)
+ addtarg(p, b, o, `Gen gt)
+ ;;
;;
}
diff --git a/mbld/types.myr b/mbld/types.myr
index c887818..dbe4689 100644
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -12,7 +12,7 @@ pkg bld =
all : byte[:][:] /* all targets, in reverse topological order */
targs : std.htab(byte[:], targ)# /* dir => target mapping */
tdeps : std.htab(byte[:], byte[:][:]) /* targname => depname[:] mapping */
- gensrc : std.htab(byte[:], gentarg#)# /* generated src => generating target mapping */
+ gensrc : std.htab(byte[:], cmdtarg#)# /* generated src => generating target mapping */
prefix : byte[:]
system : byte[:]
arch : byte[:]
@@ -22,7 +22,8 @@ pkg bld =
`Bin myrtarg#
`Lib myrtarg#
`Test myrtarg#
- `Gen gentarg#
+ `Gen cmdtarg#
+ `Cmd cmdtarg#
`Man mantarg#
;;
@@ -38,7 +39,7 @@ pkg bld =
ldscript : byte[:]
;;
- type gentarg = struct
+ type cmdtarg = struct
dir : byte[:]
out : byte[:][:]
cmd : byte[:][:]