summaryrefslogtreecommitdiff
path: root/mbld/clean.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-07-23 23:28:34 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-25 22:22:50 -0700
commita2ff9547b25b4c44d8e9095659bd282a2b4e160e (patch)
treecbf3118d1add1581684c7c72a3090a1b3ffdbb95 /mbld/clean.myr
parentcc99dfdb5dbb27ac3fed40c796a01a4269d307c2 (diff)
downloadmc-a2ff9547b25b4c44d8e9095659bd282a2b4e160e.tar.gz
New parallel mbld.
Diffstat (limited to 'mbld/clean.myr')
-rw-r--r--mbld/clean.myr85
1 files changed, 0 insertions, 85 deletions
diff --git a/mbld/clean.myr b/mbld/clean.myr
index 234d980..73ca1e5 100644
--- a/mbld/clean.myr
+++ b/mbld/clean.myr
@@ -1,93 +1,8 @@
use std
-use "config"
-use "deps"
use "opts"
-use "parse"
use "types"
use "util"
pkg bld =
- const cleanall : (b : build# -> bool)
- const clean : (b : build#, targ : byte[:] -> bool)
- const cleanmyr : (b : build#, mt : myrtarg# -> void)
;;
-
-const cleanall = {b
- for tn : b.all
- match gettarg(b.targs, tn)
- | `Bin bt:
- cleanup(b, bt, bt.inputs)
- | `Lib lt:
- cleanup(b, lt, lt.inputs)
- | `Gen gt:
- for f : gt.out
- if !gt.durable && std.remove(f)
- mbldput("\tclean {}\n", f)
- ;;
- ;;
- | `Data _: /* nothing to do */
- | `Cmd _: /* nothing to do */
- | `Man _: /* nothing to do */
- ;;
- ;;
- -> true
-}
-
-const clean = {b, targ
- for tn : b.all
- match gettarg(b.targs, tn)
- | `Bin bt:
- if std.sleq(bt.name, targ)
- cleanup(b, bt, bt.inputs)
- ;;
- | `Lib lt:
- if std.sleq(lt.name, targ)
- cleanup(b, lt, lt.inputs)
- ;;
- | `Gen gt:
- for f : gt.out
- if !gt.durable && std.remove(f)
- mbldput("\tclean {}\n", f)
- ;;
- ;;
- | `Data _: /* nothing to do */
- | `Cmd _: /* nothing to do */
- | `Man _: /* nothing to do */
- ;;
- ;;
- -> true
-}
-
-const cleanmyr = {b, targ
- cleanup(b, targ, targ.inputs)
-}
-
-const cleanup = {b, targ, leaves
- var mchammer_files /* cant touch this */
- var keys, dg, test
-
- /*
- we want to automatically add 'clean' sources since otherwise,
- mbld won't be able to clean code after changing a build file.
- */
- setdir(b, targ.dir)
- dg = myrdeps(b, targ, true, true)
- mchammer_files = std.mkht(std.strhash, std.streq)
- for l : leaves
- std.htput(mchammer_files, l, true)
- ;;
-
- keys = std.htkeys(dg.deps)
- for k : keys
- if !std.htgetv(mchammer_files, k, false) && std.remove(k)
- mbldput("\tclean {}\n", k)
- ;;
- test = std.pathcat("test", k)
- if std.remove(test)
- mbldput("\tclean {}\n", test)
- ;;
- std.slfree(test)
- ;;
-}
-