summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-04-12 22:05:49 -0700
committerOri Bernstein <ori@eigenstate.org>2015-04-12 22:05:49 -0700
commit66a103f6afd50eb45e9ba62f167688edeb10063a (patch)
tree9703bea9cbdb0c91e703e147eb6cc450e61762f0
parenta882c392dcde4b86d96b6b9e920c9d8e37f0aaad (diff)
downloadmbld-66a103f6afd50eb45e9ba62f167688edeb10063a.tar.gz
Remove subdir support from 'subdirs'.
-rw-r--r--build.myr18
-rw-r--r--deps.myr4
-rw-r--r--subdir.myr16
-rw-r--r--util.myr9
4 files changed, 20 insertions, 27 deletions
diff --git a/build.myr b/build.myr
index ff4273d..afc191b 100644
--- a/build.myr
+++ b/build.myr
@@ -39,7 +39,7 @@ const genall = {b
targs = std.htgetv(b.targs, "", [][:])
for t in targs
match t
- | `Gen gt: run(gt.cmd, "")
+ | `Gen gt: run(gt.cmd)
| _: /* skip */
;;
;;
@@ -71,7 +71,7 @@ const build = {b, targ
| `Gen gt:
for n in gt.out
if std.sleq(n, targ)
- run(gt.cmd, "")
+ run(gt.cmd)
;;
;;
| `Sub subs:
@@ -159,7 +159,7 @@ const buildlib = {b, targ
const genfiles = {b, gt
for f in gt.out
if !std.fexists(f)
- run(gt.cmd, "")
+ run(gt.cmd)
->
;;
;;
@@ -182,7 +182,7 @@ const builddep = {b, dg, out, incs
;;
if !std.fexists(d)
match std.htget(b.gensrc, d)
- | `std.Some gt: run(gt.cmd, "")
+ | `std.Some gt: run(gt.cmd)
| `std.None: std.fatal(1, "no input file %s\n", d)
;;
;;
@@ -219,7 +219,7 @@ const compile = {src, incs
cmd = std.slpush(cmd, "-S")
;;
cmd = std.slpush(cmd, src)
- run(cmd, "")
+ run(cmd)
std.slfree(cmd)
elif std.hassuffix(src, ".s")
o = srcswapsuffix(src, config.Objsuffix)
@@ -229,7 +229,7 @@ const compile = {src, incs
cmd = std.slpush(cmd,"-o")
cmd = std.slpush(cmd, o)
cmd = std.slpush(cmd, src)
- run(cmd, "")
+ run(cmd)
std.slfree(o)
else
std.fatal(1, "Unknown file type for %s\n", src)
@@ -277,7 +277,7 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extralibs
cmd = std.slpush(cmd, std.sldup("10.6"))
;;
- run(cmd, "")
+ run(cmd)
strlistfree(cmd)
}
@@ -294,7 +294,7 @@ const archivelib = {dg, lib, files, incs
obj = srcswapsuffix(f, config.Objsuffix)
cmd = std.slpush(cmd, obj)
;;
- run(cmd, "")
+ run(cmd)
strlistfree(cmd)
}
@@ -312,7 +312,7 @@ const mergeuse = {dg, lib, files, incs
std.fatal(1, "unknown file type for %s\n", f)
;;
;;
- run(cmd, "")
+ run(cmd)
strlistfree(cmd)
}
diff --git a/deps.myr b/deps.myr
index 0303913..b46a517 100644
--- a/deps.myr
+++ b/deps.myr
@@ -12,8 +12,8 @@ pkg bld =
/* a bit ugly: initialized from main() */
var usepat : regex.regex#
-
;;
+
var usepat : regex.regex#
type dep = union
@@ -177,7 +177,7 @@ const getdeps = {b, path
deps = [][:]
if !std.fexists(path)
match std.htget(b.gensrc, path)
- | `std.Some gt: run(gt.cmd, "")
+ | `std.Some gt: run(gt.cmd)
| `std.None: std.fatal(1, "no input file %s\n", path)
;;
;;
diff --git a/subdir.myr b/subdir.myr
index 210064c..0efd958 100644
--- a/subdir.myr
+++ b/subdir.myr
@@ -9,17 +9,15 @@ pkg bld =
const subdirs = {p, subs, targ
for s in subs
- match targ
- | `std.None: /* nothing */
- | `std.Some t:
- if !std.sleq(t, s)
- continue
- ;;
- ;;
-
std.put("Entering directory '%s'\n", s)
- run(p.cmd, s)
+ if !std.chdir(s)
+ std.fatal(1, "unable to enter directory %s\n", s)
+ ;;
+ run(p.cmd)
std.put("Leaving directory '%s'\n", s)
+ if !std.chdir("..")
+ std.fatal(1, "unable to leave directory %s\n", s)
+ ;;
;;
}
diff --git a/util.myr b/util.myr
index 3af71a1..c426576 100644
--- a/util.myr
+++ b/util.myr
@@ -3,7 +3,7 @@ use std
use "opts.use"
pkg bld =
- const run : (cmd : byte[:][:], dir : byte[:] -> void)
+ const run : (cmd : byte[:][:] -> void)
const printcmd
const srcsplit : (src : byte[:] -> (byte[:], byte[:], byte[:]))
const swapsuffix : (f : byte[:], suff : byte[:], newsuff : byte[:] -> byte[:])
@@ -11,7 +11,7 @@ pkg bld =
const strlistfree : (sl : byte[:][:] -> void)
;;
-const run = {cmd, dir
+const run = {cmd
var pid
printcmd(cmd)
@@ -19,11 +19,6 @@ const run = {cmd, dir
if pid == -1
std.fatal(1, "could not fork command\n")
elif pid == 0
- if dir.len > 0
- if !std.chdir(dir)
- std.fatal(1, "unable to enter directory %s\n", dir)
- ;;
- ;;
if std.execvp(cmd[0], cmd) < 0
std.fatal(1, "failed to exec %s\n", cmd[0])
;;