comparison src/compiler.sml @ 1473:d40066b38710

Handle spaces in filenames passed to GCC (caught by Zachary Tatlock)
author Adam Chlipala <adam@chlipala.net>
date Wed, 15 Jun 2011 09:52:06 -0400
parents 2f5fd248588d
children 3d0cc841cafd
comparison
equal deleted inserted replaced
1472:18d18a70821e 1473:d40066b38710
1305 print = CjrPrint.p_sql CjrEnv.empty 1305 print = CjrPrint.p_sql CjrEnv.empty
1306 } 1306 }
1307 1307
1308 val toSqlify = transform sqlify "sqlify" o toMono_opt2 1308 val toSqlify = transform sqlify "sqlify" o toMono_opt2
1309 1309
1310 val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch)
1311
1310 fun compileC {cname, oname, ename, libs, profile, debug, link = link'} = 1312 fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
1311 let 1313 let
1312 val proto = Settings.currentProtocol () 1314 val proto = Settings.currentProtocol ()
1313 1315
1314 val lib = if Settings.getStaticLinking () then 1316 val lib = if Settings.getStaticLinking () then
1316 else 1318 else
1317 "-L" ^ Config.lib ^ "/.. -lurweb " ^ #linkDynamic proto 1319 "-L" ^ Config.lib ^ "/.. -lurweb " ^ #linkDynamic proto
1318 1320
1319 val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ 1321 val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ
1320 ^ " " ^ #compile proto 1322 ^ " " ^ #compile proto
1321 ^ " -c " ^ cname ^ " -o " ^ oname 1323 ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname
1322 1324
1323 val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname 1325 val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ escapeFilename oname
1324 ^ " -o " ^ ename ^ " " ^ libs 1326 ^ " -o " ^ escapeFilename ename ^ " " ^ libs
1325 1327
1326 val (compile, link) = 1328 val (compile, link) =
1327 if profile then 1329 if profile then
1328 (compile ^ " -pg", link ^ " -pg") 1330 (compile ^ " -pg", link ^ " -pg")
1329 else 1331 else