summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-28 17:49:30 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-28 17:49:30 -0800
commit5f46919fc6a471d9a75bb25fae64aecefc9ec864 (patch)
tree4f3e1c8c95b085551c4cfc8147c9d11724165845 /mbld
parente11b9bf807b4579823305419db7c7682e4f7a1d5 (diff)
downloadmc-5f46919fc6a471d9a75bb25fae64aecefc9ec864.tar.gz
Add 'cleanfirst' option.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/clean.myr5
-rw-r--r--mbld/main.myr10
2 files changed, 15 insertions, 0 deletions
diff --git a/mbld/clean.myr b/mbld/clean.myr
index dcd1738..0aa6c50 100644
--- a/mbld/clean.myr
+++ b/mbld/clean.myr
@@ -10,6 +10,7 @@ use "util.use"
pkg bld =
const cleanall : (b : build# -> bool)
const clean : (b : build#, targ : byte[:] -> bool)
+ const cleanmyr : (b : build#, mt : myrtarg# -> void)
;;
const cleanall = {b
@@ -56,6 +57,10 @@ const clean = {b, targ
-> true
}
+const cleanmyr = {b, targ
+ cleanup(b, targ, targ.inputs)
+}
+
const cleanup = {b, targ, leaves
var mchammer_files /* cant touch this */
var keys, dg
diff --git a/mbld/main.myr b/mbld/main.myr
index 200c3e8..428892b 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -16,6 +16,7 @@ use "syssel.use"
const main = {args : byte[:][:]
var b : bld.build#
var mt : bld.myrtarg
+ var cleanfirst
var dumponly
var targname
var bintarg
@@ -23,9 +24,11 @@ const main = {args : byte[:][:]
var tags
dumponly = false
+ cleanfirst = false
cmd = std.optparse(args, &[
.argdesc = "[inputs...]",
.opts = [
+ [.opt='c', .desc="clean before building"],
[.opt='T', .desc="list all available targets"],
[.opt='t', .arg="tag", .desc="build with specified systag"],
[.opt='S', .desc="generate assembly when building"],
@@ -47,6 +50,7 @@ const main = {args : byte[:][:]
match opt
| ('T', ""): dumponly = true
| ('S', ""): bld.opt_genasm = true
+ | ('c', ""): cleanfirst = true
| ('I', arg): bld.opt_incpaths = std.slpush(bld.opt_incpaths, arg)
| ('R', arg): bld.opt_instroot = arg
| ('t', tag): tags = std.slpush(tags, tag)
@@ -83,6 +87,9 @@ const main = {args : byte[:][:]
.incpath=bld.opt_incpaths,
.libdeps=[][:]
]
+ if cleanfirst
+ bld.cleanmyr(b, &mt)
+ ;;
if bintarg
bld.buildbin(b, &mt, true)
else
@@ -99,6 +106,9 @@ const main = {args : byte[:][:]
bld.load(b)
/*bld.configure()*/
/* default: buildall */
+ if cleanfirst
+ bld.cleanall(b)
+ ;;
if cmd.args.len == 0
bld.buildall(b)
else