comparison src/compiler.sml @ 742:43553c93dd8c

Reading blobs from the database
author Adam Chlipala <adamc@hcoop.net>
date Sun, 26 Apr 2009 10:45:59 -0400
parents f2a2be93331c
children 7f653298dd66
comparison
equal deleted inserted replaced
741:f7e2026dd5ae 742:43553c93dd8c
603 print = CjrPrint.p_sql CjrEnv.empty 603 print = CjrPrint.p_sql CjrEnv.empty
604 } 604 }
605 605
606 val toSqlify = transform sqlify "sqlify" o toMono_opt2 606 val toSqlify = transform sqlify "sqlify" o toMono_opt2
607 607
608 fun compileC {cname, oname, ename, libs, profile} = 608 fun compileC {cname, oname, ename, libs, profile, debug} =
609 let 609 let
610 val urweb_o = clibFile "urweb.o" 610 val urweb_o = clibFile "urweb.o"
611 val driver_o = clibFile "driver.o" 611 val driver_o = clibFile "driver.o"
612 612
613 val compile = "gcc " ^ Config.gccArgs ^ " -Wstrict-prototypes -Werror -O3 -I include -c " ^ cname ^ " -o " ^ oname 613 val compile = "gcc " ^ Config.gccArgs ^ " -Wstrict-prototypes -Werror -O3 -I include -c " ^ cname ^ " -o " ^ oname
614 val link = "gcc -Werror -O3 -lm -lmhash -pthread " ^ libs ^ " " ^ urweb_o ^ " " ^ oname ^ " " ^ driver_o ^ " -o " ^ ename 614 val link = "gcc -Werror -O3 -lm -lmhash -pthread " ^ libs ^ " " ^ urweb_o ^ " " ^ oname ^ " " ^ driver_o ^ " -o " ^ ename
615 615
616 val (compile, link) = 616 val (compile, link) =
617 if profile then 617 if profile then
618 (compile ^ " -pg", link ^ " -pg") 618 (compile ^ " -pg", link ^ " -pg")
619 else
620 (compile, link)
621
622 val (compile, link) =
623 if debug then
624 (compile ^ " -g", link ^ " -g")
619 else 625 else
620 (compile, link) 626 (compile, link)
621 in 627 in
622 if not (OS.Process.isSuccess (OS.Process.system compile)) then 628 if not (OS.Process.isSuccess (OS.Process.system compile)) then
623 print "C compilation failed\n" 629 print "C compilation failed\n"
680 in 686 in
681 Print.fprint s (CjrPrint.p_sql CjrEnv.empty file); 687 Print.fprint s (CjrPrint.p_sql CjrEnv.empty file);
682 TextIO.closeOut outf 688 TextIO.closeOut outf
683 end; 689 end;
684 690
685 compileC {cname = cname, oname = oname, ename = ename, libs = libs, profile = #profile job}; 691 compileC {cname = cname, oname = oname, ename = ename, libs = libs,
692 profile = #profile job, debug = #debug job};
686 693
687 cleanup () 694 cleanup ()
688 end 695 end
689 handle ex => (((cleanup ()) handle _ => ()); raise ex) 696 handle ex => (((cleanup ()) handle _ => ()); raise ex)
690 end 697 end