diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-06-15 09:52:06 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-06-15 09:52:06 -0400 |
commit | 8d6c0435d5f8ff60106210611c657d050fb8168b (patch) | |
tree | 0c3cdd6f2a931a079df5760829f443a1e574cf6c /src | |
parent | 98c8150aeee09e8b565389f41dd854fcb81de5a8 (diff) |
Handle spaces in filenames passed to GCC (caught by Zachary Tatlock)
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler.sml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler.sml b/src/compiler.sml index 6d9c8166..27529251 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -1307,6 +1307,8 @@ val sqlify = { val toSqlify = transform sqlify "sqlify" o toMono_opt2 +val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch) + fun compileC {cname, oname, ename, libs, profile, debug, link = link'} = let val proto = Settings.currentProtocol () @@ -1318,10 +1320,10 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} = val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ ^ " " ^ #compile proto - ^ " -c " ^ cname ^ " -o " ^ oname + ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname - val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname - ^ " -o " ^ ename ^ " " ^ libs + val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ escapeFilename oname + ^ " -o " ^ escapeFilename ename ^ " " ^ libs val (compile, link) = if profile then |