Debian Codegraph @

test cases/common/135 custom target object output/obj_generator.py

raw
1 #!/usr/bin/env python3
2
3 # Mimic a binary that generates an object file (e.g. windres).
4
5 import sys, subprocess
6
7 if __name__ == '__main__':
8 if len(sys.argv) != 4:
9 print(sys.argv[0], 'compiler input_file output_file')
10 sys.exit(1)
11 compiler = sys.argv[1]
12 ifile = sys.argv[2]
13 ofile = sys.argv[3]
14 if compiler.endswith('cl'):
15 cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile]
16 else:
17 cmd = [compiler, '-c', ifile, '-o', ofile]
18 sys.exit(subprocess.call(cmd))