summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-23 08:32:40 +0800
committerruki <[email protected]>2016-06-23 08:32:40 +0800
commite5be4eb9b765b7b3aea3e3d603059e5480e1c7bb (patch)
tree140f7f764cba78f68f7ed5fc36a92f40ab591e91
parent920ba6e7d186b71d48efefe130e99ebc398beca4 (diff)
fix checker for the gcc flags: --coverage
-rwxr-xr-xxmake/tools/gcc.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua
index 14761ae0f..a576618fc 100755
--- a/xmake/tools/gcc.lua
+++ b/xmake/tools/gcc.lua
@@ -122,7 +122,16 @@ end
-- check the given flags
function check(flags)
+ -- make an stub source file
+ local objfile = path.join(os.tmpdir(), "xmake.gcc.o")
+ local srcfile = path.join(os.tmpdir(), "xmake.gcc.c")
+ io.write(srcfile, "int main(int argc, char** argv)\n{return 0;}")
+
-- check it
- os.run("%s %s -S -o %s -xc %s", _g.shellname, ifelse(flags, flags, ""), os.nuldev(), os.nuldev())
+ os.run("%s -c %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), objfile, srcfile)
+
+ -- remove files
+ os.rm(objfile)
+ os.rm(srcfile)
end