diff src/compiler.sml @ 102:5f04adf47f48

Writing HTML
author Adam Chlipala <adamc@hcoop.net>
date Thu, 10 Jul 2008 14:02:54 -0400
parents 82aaa1c406d3
children 813e5a52063d
line wrap: on
line diff
--- a/src/compiler.sml	Thu Jul 10 11:13:49 2008 -0400
+++ b/src/compiler.sml	Thu Jul 10 14:02:54 2008 -0400
@@ -345,11 +345,25 @@
         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