summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2017-10-05 18:23:28 -0700
committerOri Bernstein <ori@markovcorp.com>2017-10-05 18:23:28 -0700
commitccc18d6ab171efa2a512f3c79c535a27b5baec7f (patch)
treed1213aafa4c6723bbf47724773de532d56a025ee /mbld
parent0cf1870f4b5a8a547ce1334e6e83cc0275b94774 (diff)
downloadmc-ccc18d6ab171efa2a512f3c79c535a27b5baec7f.tar.gz
Allow passing some flags to the build.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/deps.myr9
-rw-r--r--mbld/opts.myr68
2 files changed, 51 insertions, 26 deletions
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 2783dee..fa894f4 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -402,6 +402,9 @@ const checkloop = {g, n, visited, looped, stk
const musecmd = {b, n, mt, mu
std.slpush(&n.cmd, std.sldup(opt_muse))
+ for o : opt_museflags
+ std.slpush(&n.cmd, o)
+ ;;
std.slpush(&n.cmd, std.sldup("-o"))
std.slpush(&n.cmd, std.sldup(mu))
std.slpush(&n.cmd, std.sldup("-p"))
@@ -425,6 +428,9 @@ const linkcmd = {b, n, mt, bin, libs, dynlibs, istest
for c : config.Linkcmd
std.slpush(&n.cmd, std.sldup(c))
;;
+ for o : opt_ldflags
+ std.slpush(&n.cmd, o)
+ ;;
std.slpush(&n.cmd, std.sldup(bin))
if mt.ldscript.len > 0
std.slpush(&n.cmd, std.sldup("-T"))
@@ -459,6 +465,9 @@ const linkcmd = {b, n, mt, bin, libs, dynlibs, istest
const myrcmd = {b, n, mt, src, istest
std.slpush(&n.cmd, std.sldup(opt_mc))
+ for o : opt_mcflags
+ std.slpush(&n.cmd, o)
+ ;;
if opt_objdir.len > 0
pushopt(&n.cmd, "-O", std.sldup(opt_objdir))
;;
diff --git a/mbld/opts.myr b/mbld/opts.myr
index 7f73350..6b5e4c5 100644
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -4,18 +4,21 @@ use thread
use "config"
pkg bld =
- var opt_arch : byte[:]
- var opt_sys : byte[:]
- var opt_sysvers : (int, int, int)
- var opt_runtime : byte[:]
- var opt_genasm : bool
+ var opt_arch : byte[:]
+ var opt_sys : byte[:]
+ var opt_sysvers : (int, int, int)
+ var opt_runtime : byte[:]
+ var opt_genasm : bool
var opt_incpaths : byte[:][:]
+ var opt_mcflags : byte[:][:]
+ var opt_museflags : byte[:][:]
+ var opt_ldflags : byte[:][:]
var opt_instbase : byte[:]
- var opt_destdir : byte[:]
- var opt_objdir : byte[:]
- var opt_maxproc : std.size
- var opt_debug : bool
- var opt_silent : bool
+ var opt_destdir : byte[:]
+ var opt_objdir : byte[:]
+ var opt_maxproc : std.size
+ var opt_debug : bool
+ var opt_silent : bool
/* undocumented/unsupported opts */
var opt_mc : byte[:]
@@ -29,25 +32,26 @@ pkg bld =
const parseversion : (v : byte[:] -> (int, int, int))
;;
-var opt_arch = ""
-var opt_sys = ""
-var opt_binname = ""
-var opt_libname = ""
-var opt_runtime = ""
+var opt_arch = ""
+var opt_sys = ""
+var opt_binname = ""
+var opt_libname = ""
+var opt_runtime = ""
var opt_incpaths /* FIXME: taking a constant slice is a nonconstant initializer */
var opt_instbase = ""
-var opt_destdir = ""
+var opt_destdir = ""
var opt_sysvers
-var opt_debug = false
-var opt_mc = "6m"
-var opt_as = "as"
-var opt_muse = "muse"
-var opt_ld = "ld"
-var opt_ar = "ar"
-var opt_objdir = "obj"
-var opt_genasm = false
-var opt_silent = false
-var opt_maxproc = 1
+var opt_debug = false
+var opt_mc = "6m"
+var opt_as = "as"
+var opt_muse = "muse"
+var opt_mcflags = [][:]
+var opt_museflags = [][:]
+var opt_ldflags = [][:]
+var opt_objdir = "obj"
+var opt_genasm = false
+var opt_silent = false
+var opt_maxproc = 1
const initopts = {
var si
@@ -78,6 +82,18 @@ const initopts = {
opt_mc = std.getenvv("MYR_MC", "6m")
opt_muse = std.getenvv("MYR_MUSE", "muse")
opt_runtime = std.getenvv("MYR_RT", "")
+ match std.getenv("MYR_MCFLAGS")
+ | `std.Some s: opt_mcflags = std.strtok(s)
+ | `std.None: /* ok */
+ ;;
+ match std.getenv("MYR_MUSEFLAGS")
+ | `std.Some s: opt_mcflags = std.strtok(s)
+ | `std.None: /* ok */
+ ;;
+ match std.getenv("MYR_LDFLAGS")
+ | `std.Some s: opt_ldflags = std.strtok(s)
+ | `std.None: /* ok */
+ ;;
if opt_runtime.len == 0
opt_runtime = std.pathjoin([opt_instbase, config.Libpath, config.Runtime][:])
;;