summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-03-05 13:52:17 -0800
committerOri Bernstein <ori@eigenstate.org>2017-03-05 13:54:27 -0800
commitb3d835e235336f8c0e1979fe009eefb24117a169 (patch)
tree67bcc668d9e2b2c521e2872908d529ce60c2b2d4 /mbld
parentb623656b7898648e82dcc0adc5c4d03a5ba9b5da (diff)
parent2bb663c4e88ad3602a2402a039b18a30d7acf556 (diff)
downloadmc-b3d835e235336f8c0e1979fe009eefb24117a169.tar.gz
Merge branch 'master' of git+ssh://git.eigenstate.org/git/ori/mc
Diffstat (limited to 'mbld')
-rw-r--r--mbld/deps.myr13
-rw-r--r--mbld/util.myr19
2 files changed, 20 insertions, 12 deletions
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 0b66b5b..59a4e75 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -148,7 +148,7 @@ const srcdeps = {b, ds, g, path, obj, usefile
;;
std.exit(1)
;;
- deps = getdeps(b, ds, path)
+ deps = getdeps(b, ds, path, std.dirname(path))
std.htput(g.seen, path, true)
for d in deps
match d
@@ -253,7 +253,7 @@ const getcflags = {ln, cflags, libs
-> (cflags, libs)
}
-const getdeps = {b, ds, path
+const getdeps = {b, ds, path, dir
var deps, lnum
var f
@@ -266,7 +266,7 @@ const getdeps = {b, ds, path
| `bio.Err e: std.fatal("unable to read {}: {}\n", path, e)
| `bio.Eof: break
| `bio.Ok ln:
- deps = depname(deps, ln, lnum)
+ deps = depname(deps, ln, lnum, dir)
std.slfree(ln)
;;
;;
@@ -288,7 +288,9 @@ const opensrc = {b, path
;;
}
-const depname = {deps, ln, lnum
+const depname = {deps, ln, lnum, dir
+ var p
+
/*
the regex pattern does some contortions to either grab
an unquoted path and put it into uses[4], or a quoted
@@ -299,7 +301,8 @@ const depname = {deps, ln, lnum
if uses[2].len > 0
std.slpush(&deps, `Lib (std.sldup(uses[2]), lnum))
else
- std.slpush(&deps, `Local (std.sldup(uses[3]), lnum))
+ p = std.pathcat(dir, std.sldup(uses[3]))
+ std.slpush(&deps, `Local (p, lnum))
;;
regex.matchfree(uses)
| `std.None:
diff --git a/mbld/util.myr b/mbld/util.myr
index 7054ac5..dc03bdc 100644
--- a/mbld/util.myr
+++ b/mbld/util.myr
@@ -59,22 +59,27 @@ const printcmd = {lst
}
const srcsplit = {src
- var platf, suff
+ var platf, fbase, suff
platf = ""
suff = ""
- match std.strfind(src, ".")
+
+ match std.strfind(src, "/")
+ | `std.Some i: fbase = i
+ | `std.None: fbase = 0
+ ;;
+ match std.strfind(src[fbase:], ".")
| `std.Some i:
- suff = src[i:]
- src = src[:i]
+ suff = src[fbase+i:]
+ src = src[:fbase+i]
| `std.None:
/* no suffix to trim */
;;
- match std.strrfind(src, "+")
+ match std.strrfind(src[fbase:], "+")
| `std.Some i:
- platf = src[i:]
- src = src[:i]
+ platf = src[fbase+i:]
+ src = src[:fbase+i]
| `std.None:
/* no platform to trim */
;;