ref: 28deb6d3703a6d8b62f053223c4e79b16419dcce
parent: 0108959477bb98715acc6b295f60b09d5660ab07
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Oct 1 14:44:53 EDT 2014
Fix compilation of assembly source. We now handle .s files.
--- a/build.myr
+++ b/build.myr
@@ -128,18 +128,26 @@
match std.htget(dg.sources, out)
| `std.Some src:
if stale
- if std.hassuffix(src, ".myr")
- run(["6m", src][:], "")
- elif std.hassuffix(src, ".myr")
- run(["as", src][:], "")
- else
- std.fatal(1, "Unknown file type for %s\n", src)
- ;;
+ compile(src)
;;
std.htput(dg.updated, out, true)
| `std.None:
;;
-> stale
+}
+
+const compile = {src
+ var o
+
+ if std.hassuffix(src, ".myr")
+ run(["6m", src][:], "")
+ elif std.hassuffix(src, ".s")
+ o = swapsuffix(src, ".s", ".o")
+ run(["as", src, "-o", o][:], "")
+ std.slfree(o)
+ else
+ std.fatal(1, "Unknown file type for %s\n", src)
+ ;;
}
const linkbin = {dg, bin, srcfiles, ldscript, rt
--- a/deps.myr
+++ b/deps.myr
@@ -42,14 +42,18 @@
;;
for src in leaves
obj = srcswapsuffix(src, ".o")
- usefile = srcswapsuffix(src, ".use")
std.htput(dg.sources, obj, src)
- std.htput(dg.sources, usefile, src)
pushdep(dg, obj, out)
pushdep(dg, src, obj)
- pushdep(dg, src, usefile)
- if islib
- pushdep(dg, usefile, useout)
+ if std.hassuffix(src, ".myr")
+ usefile = srcswapsuffix(src, ".use")
+ std.htput(dg.sources, usefile, src)
+ pushdep(dg, src, usefile)
+ if islib
+ pushdep(dg, usefile, useout)
+ ;;
+ else
+ usefile = ""
;;
srcdeps(dg, seentab, donetab, src, obj, usefile)
;;