aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2012-12-24 10:45:26 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2012-12-24 10:45:26 +0200
commit066548a657cf2d43cb2a1d5a7420afa315d9684f (patch)
tree62b32355d284acd38f98f1881b1e5105b17e1f60
parentf07e43cb37b39ad6e2b612a5d99d0cde3d3835d1 (diff)
downloadmeson-066548a657cf2d43cb2a1d5a7420afa315d9684f.zip
meson-066548a657cf2d43cb2a1d5a7420afa315d9684f.tar.gz
meson-066548a657cf2d43cb2a1d5a7420afa315d9684f.tar.bz2
Build command line.
-rwxr-xr-xenvironment.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/environment.py b/environment.py
index 5af333c..02fe841 100755
--- a/environment.py
+++ b/environment.py
@@ -36,6 +36,12 @@ class CCompiler():
def get_exelist(self):
return self.exelist
+
+ def get_compile_only_flags(self):
+ return ['-c']
+
+ def get_output_flags(self):
+ return ['-o']
class GnuCCompiler(CCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
@@ -49,5 +55,22 @@ class GnuCCompiler(CCompiler):
def get_std_opt_flags(self):
return GnuCCompiler.std_opt_flags
-if __name__ == '__main__':
+
+def shell_quote(cmdlist):
+ return ["'" + x + "'" for x in cmdlist]
+
+def test_cmd_line_building():
+ src_file = 'file.c'
+ dst_file = 'file.o'
gnuc = detect_c_compiler('/usr/bin/cc')
+ cmds = gnuc.get_exelist()
+ cmds += gnuc.get_std_warn_flags()
+ cmds += gnuc.get_compile_only_flags()
+ cmds.append(src_file)
+ cmds += gnuc.get_output_flags()
+ cmds.append(dst_file)
+ cmd_line = ' '.join(shell_quote(cmds))
+ print(cmd_line)
+
+if __name__ == '__main__':
+ test_cmd_line_building()