summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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