summaryrefslogtreecommitdiff
path: root/src/compiler.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-10 14:02:54 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-10 14:02:54 -0400
commit425bb7f90ffc8a6f8a1590ed76f305f3029a0beb (patch)
tree5b6d5cf41f31998021e1b29ce4407de55dba12bc /src/compiler.sml
parent5f2f492e122a26017496ed57d76ae39c6b1b254a (diff)
Writing HTML
Diffstat (limited to 'src/compiler.sml')
-rw-r--r--src/compiler.sml18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 592191c8..1e40cb11 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -345,11 +345,25 @@ fun compile job =
NONE => ()
| SOME file =>
let
- val outf = TextIO.openOut "/tmp/lacweb.c"
+ val cname = "/tmp/lacweb.c"
+ val oname = "/tmp/lacweb.o"
+ val ename = "/tmp/webapp"
+
+ val compile = "gcc -I include -c " ^ cname ^ " -o " ^ oname
+ val link = "gcc clib/lacweb.o " ^ oname ^ " clib/driver.o -o " ^ ename
+
+ val outf = TextIO.openOut cname
val s = TextIOPP.openOut {dst = outf, wid = 80}
in
Print.fprint s (CjrPrint.p_file CjrEnv.empty file);
- TextIO.closeOut outf
+ TextIO.closeOut outf;
+
+ if not (OS.Process.isSuccess (OS.Process.system compile)) then
+ print "C compilation failed\n"
+ else if not (OS.Process.isSuccess (OS.Process.system link)) then
+ print "C linking failed\n"
+ else
+ print "Success\n"
end
end