summaryrefslogtreecommitdiff
path: root/mbld/deps.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-10-01 00:50:08 -0700
committerOri Bernstein <ori@eigenstate.org>2015-10-01 22:35:32 -0700
commitd7d95f9f1db8434f40d5ac3c81ba486223e3893b (patch)
tree854c7831284c9881afb1528a669e0587a7879114 /mbld/deps.myr
parentd60e706a5f499863320b9359519438c62a4df303 (diff)
downloadmc-d7d95f9f1db8434f40d5ac3c81ba486223e3893b.tar.gz
Add muse support for C linking on Linux.
We know know about foo.glue.c, which will attempt to link in libfoo. We don't do anything about dependencies of libfoo yet.
Diffstat (limited to 'mbld/deps.myr')
-rw-r--r--mbld/deps.myr18
1 files changed, 14 insertions, 4 deletions
diff --git a/mbld/deps.myr b/mbld/deps.myr
index e269250..710ab70 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -9,15 +9,20 @@ use "util.use"
pkg bld =
const myrdeps : (b : build#, mt : myrtarg#, doclean : bool, addsrc : bool -> depgraph#)
-
- /* a bit ugly: initialized from main() */
- var usepat : regex.regex#
;;
const Abiversion = 8
var usepat : regex.regex#
+const __init__ = {
+ match regex.compile("^\\s*use\\s+((\\<\\S+\\>)|\"(\\S+)\").*")
+ | `std.Ok re: usepat = re
+ | `std.Fail f: std.fatal("Failed to compile use pattern regex\n")
+ ;;
+}
+
+
type dep = union
`Local (byte[:], int)
`Lib (byte[:], int)
@@ -33,7 +38,7 @@ type depscan = struct
;;
const myrdeps = {b, mt, doclean, addsrc
- var objs, uses, srcs
+ var objs, uses, srcs, clib
var out, useout
var dg : depgraph#
var ds : depscan
@@ -47,6 +52,7 @@ const myrdeps = {b, mt, doclean, addsrc
.updated = std.mkht(std.strhash, std.streq),
.seen = std.mkht(std.strhash, std.streq),
.done = std.mkht(std.strhash, std.streq),
+ .dynamic = false,
])
/* direct dependencies of binary */
if mt.islib
@@ -74,6 +80,10 @@ const myrdeps = {b, mt, doclean, addsrc
if std.hassuffix(srcs[i], ".myr")
std.htput(dg.input, uses[i], srcs[i])
pushdep(dg, srcs[i], uses[i])
+ elif std.hassuffix(srcs[i], ".glue.c")
+ clib = swapsuffix(srcs[i], ".glue.c", "")
+ std.htput(dg.libs, clib, [][:])
+ dg.dynamic = true
;;
;;