ref: ac297546f368b4adc1b0f21ecd69eb9eb33eb329
parent: cc3afe8080e433d68406cf51615a9530ecbbba68
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Nov 3 17:22:05 EDT 2017
Rebuild when installed libraries change.
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -125,7 +125,7 @@
const stale = {b, n
var staletime
- staletime = 0
+ staletime = n.deptime
for d : n.ndep
staletime = std.max(staletime, d.mtime)
;;
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -589,7 +589,7 @@
depends(g, n, ldep.genuse)
depends(g, n, ldep.genar)
;;
- std.slpush(&n.xdep, dep)
+ n.deptime = std.max(n.deptime, ldep.mtime)
| `std.None:
std.fatal("unknown xdep {} (known: {})\n", dep, std.htkeys(b.libs))
;;
@@ -631,7 +631,6 @@
.cmd=[][:],
.gen=[][:],
.dep=[][:],
- .xdep=[][:],
.nblock=0,
.mtime=0,
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -46,7 +46,7 @@
}
const scrapelib = {b, targ, lib, incs
- var dep, dyndep, ldep
+ var path, dep, dyndep, ldep
var f, dir
if std.hthas(b.libs, lib)
@@ -53,7 +53,7 @@
-> void
;;
- (f, dir) = openlib(lib, targ, incs)
+ (f, path, dir) = openlib(lib, targ, incs)
match bio.getc(f)
| `std.Ok 'U': /* ok */
| `std.Ok _: std.fput(1, "{}/{}: not a usefile\n", dir, lib)
@@ -84,7 +84,9 @@
.dyndep=dyndep,
.genuse="",
.genar="",
+ .mtime=std.tryv(std.fmtime(path), 0)
])
+ std.slfree(path)
std.htput(b.libs, lib, ldep)
for d : dep
@@ -103,10 +105,8 @@
std.slfree(libname)
if std.fisreg(path)
match bio.open(path, bio.Rd)
- | `std.Ok file:
- std.slfree(path)
- -> (file, p)
- | `std.Err m:
+ | `std.Ok file: -> (file, path, p)
+ | `std.Err m: /* next */
;;
std.fatal("{}: {} does not exist in {j=, }\n", targ, lib, incs)
;;
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -82,6 +82,7 @@
dyndep : byte[:][:]
genuse : byte[:]
genar : byte[:]
+ mtime : std.time
;;
type testresult = union
@@ -114,7 +115,7 @@
/* dependency names */
gen : byte[:][:]
dep : byte[:][:]
- xdep : byte[:][:]
+ deptime : std.time
/* resolved dependency nodes */
ndep : node#[:]