ref: 3bf2f2e262eebfcc1699d45f6717ae6a07cb32a7
parent: 62a6dc43879c5eb846f0e918bd489e61d8401057
author: Ori Bernstein <ori@eigenstate.org>
date: Tue May 31 15:44:34 EDT 2016
Add top level 'incpath' and 'libdep' directives. mbld now accepts libdeps foo = @path/to/lib:name ../bar/baz:what ;; incpath foo = @path/to/lib:name ../bar/baz:what ;; in bld files.
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -20,6 +20,7 @@
/* default parameter values */
incpath : byte[:][:]
+ libdeps : byte[:][:]
runtime : byte[:]
ldscript: byte[:]
istest : bool
@@ -205,9 +206,10 @@
| `std.Some "man": mantarget(b, p)
| `std.Some "sub": subtarget(b, p)
/* global attributes */
- | `std.Some "incpath": incpath(b, p)
- | `std.Some "runtime": p.runtime = expectword(b, p, "incpath")
- | `std.Some "ldscript": p.runtime = expectword(b, p, "runtime")
+ | `std.Some "incpath": incpath(b, p, &p.incpath, "incpath")
+ | `std.Some "libdeps": incpath(b, p, &p.libdeps, "libdeps")
+ | `std.Some "runtime": p.runtime = expectword(b, p, "runtime")
+ | `std.Some "ldscript": p.runtime = expectword(b, p, "ldscript")
| `std.Some "noinst": p.install = false
/* no word */
| `std.Some targtype: failparse(p, "unknown keyword {}\n", targtype)
@@ -216,22 +218,23 @@
-> true
}
-/* incpath: '=' wordlist ';;' */
-const incpath = {b, p
+/* <name>: '=' wordlist ';;' */
+const incpath = {b, p, words, name
skipspace(p)
if !matchc(p, '=')
- failparse(p, "expected '=' after incpath\n")
+ failparse(p, "expected '=' after {}\n", name)
;;
match wordlist(p)
- | `std.Some path: p.incpath = path
+ | `std.Some path: words# = path
| `std.None:
;;
skipspace(p)
if !matchc(p, ';') || !matchc(p, ';')
- failparse(p, "expected ';;' after incpath path list\n")
+ failparse(p, "expected ';;' after {} list\n", name)
;;
}
+
const expectword = {b, p, attr
match word(p)
| `std.Some w: -> w
@@ -368,7 +371,7 @@
*/
const myrtarget = {b, p, targ
var ldscript, runtime, install, incpath, tags
- var name, inputs, libdeps, attrs
+ var name, inputs, libdeps, libdep, attrs
var istest
var fsel
@@ -414,9 +417,12 @@
runtime = p.runtime
ldscript = p.ldscript
incpath = [][:]
- for path in p.incpath
- std.slpush(&incpath, path)
+ std.sljoin(&incpath, p.incpath)
+ for l in p.libdeps
+ libdep = libpath(p, l)
+ std.slpush(&libdeps, libdep)
;;
+
tags = [][:]
for elt in attrs
match elt
@@ -434,9 +440,8 @@
std.fatal("{}: got invalid attr '{} = {}'\n", targ, invalid, attr)
;;
;;
- for inc in bld.opt_incpaths
- std.slpush(&incpath, std.sldup(inc))
- ;;
+ std.sljoin(&incpath, bld.opt_incpaths)
+ std.sljoin(&incpath, bld.opt_incpaths)
-> std.mk([
/* target */
.dir=std.sldup(p.fdir),