diff src/compiler.sml @ 1095:bed675db3aff

Dynamic linking of the runtime system
author Adam Chlipala <adamc@hcoop.net>
date Sun, 27 Dec 2009 13:18:32 -0500
parents db52c32dbe42
children 324c9ffe8ff9
line wrap: on
line diff
--- a/src/compiler.sml	Sun Dec 27 10:37:24 2009 -0500
+++ b/src/compiler.sml	Sun Dec 27 13:18:32 2009 -0500
@@ -1025,13 +1025,17 @@
 fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
     let
         val proto = Settings.currentProtocol ()
-        val urweb_o = clibFile "urweb.o"
-        val memmem_o = clibFile "memmem.o"
+
+        val lib = if Settings.getStaticLinking () then
+                      clibFile "request.o" ^ " " ^ clibFile "queue.o" ^ " " ^ clibFile "urweb.o"
+                      ^ " " ^ clibFile "memmem.o" ^ " " ^ #linkStatic proto
+                  else
+                      "-L" ^ Config.libC ^ " -lurweb " ^ #linkDynamic proto
 
         val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ
                       ^ " -c " ^ cname ^ " -o " ^ oname
-        val link = "gcc -Werror -O3 -lm -lmhash -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ urweb_o ^ " " ^ oname
-                   ^ " " ^ memmem_o ^ " " ^ #link proto ^ " -o " ^ ename
+        val link = "gcc -Werror -O3 -lm -lmhash -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ oname
+                   ^ " -o " ^ ename
 
         val (compile, link) =
             if profile then