comparison src/compiler.sml @ 1822:8bc16ff91d32

Edward Z. Yang's patch to avoid repeating linker arguments
author Adam Chlipala <adam@chlipala.net>
date Wed, 19 Sep 2012 14:20:47 -0400
parents 28986cfac833
children 05e3365292cd
comparison
equal deleted inserted replaced
1817:148203744882 1822:8bc16ff91d32
1440 1440
1441 val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch) 1441 val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch)
1442 1442
1443 val beforeC = ref (fn () => ()) 1443 val beforeC = ref (fn () => ())
1444 1444
1445 structure StringSet = BinarySetFn(struct
1446 type ord_key = string
1447 val compare = String.compare
1448 end)
1449
1445 fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} = 1450 fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} =
1446 let 1451 let
1447 val proto = Settings.currentProtocol () 1452 val proto = Settings.currentProtocol ()
1448 1453
1449 val lib = if Settings.getStaticLinking () then 1454 val lib = if Settings.getStaticLinking () then
1476 if debug then 1481 if debug then
1477 (compile ^ " -g", link ^ " -g") 1482 (compile ^ " -g", link ^ " -g")
1478 else 1483 else
1479 (compile, link) 1484 (compile, link)
1480 1485
1481 val link = foldl (fn (s, link) => link ^ " " ^ s) link link' 1486 val link = #1 (foldl
1487 (fn (s, (link, set)) =>
1488 if StringSet.member (set, s) then
1489 (link, set)
1490 else
1491 ((link ^ " " ^ s), StringSet.add (set, s)))
1492 (link, StringSet.empty)
1493 link')
1482 1494
1483 fun system s = 1495 fun system s =
1484 (if debug then 1496 (if debug then
1485 print (s ^ "\n") 1497 print (s ^ "\n")
1486 else 1498 else