Split files into mips1 and mips2 folders

This commit is contained in:
David Benepe
2020-07-03 14:08:49 -05:00
parent 024c9b99ee
commit 80dd7027a6
144 changed files with 501 additions and 178 deletions
File diff suppressed because it is too large Load Diff
+22 -6
View File
@@ -4,9 +4,9 @@ import os
import shlex
import subprocess
import tempfile
import asm_processor
dir_path = os.path.dirname(os.path.realpath(__file__))
asm_processor = ['python3', os.path.join(dir_path, "asm-processor.py")]
prelude = os.path.join(dir_path, "prelude.inc")
all_args = sys.argv[1:]
@@ -27,10 +27,26 @@ del compile_args[out_ind + 1]
del compile_args[out_ind]
in_dir = os.path.split(os.path.realpath(in_file))[0]
opt_flags = [x for x in compile_args if x in ['-g', '-O2', '-framepointer']]
opt_flags = [x for x in compile_args if x in ['-g3', '-g', '-O1', '-O2', '-framepointer']]
preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c')
preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c', delete=False)
subprocess.check_call(asm_processor + opt_flags + [in_file], stdout=preprocessed_file)
subprocess.check_call(compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name])
subprocess.check_call(asm_processor + opt_flags + [in_file, '--post-process', out_file, '--assembler', assembler_sh, '--asm-prelude', prelude])
try:
asmproc_flags = opt_flags + [in_file, '--input-enc', 'utf-8', '--output-enc', 'euc-jp']
compile_cmdline = compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name]
asm_processor.run(asmproc_flags, outfile=preprocessed_file)
try:
subprocess.check_call(compile_cmdline)
except subprocess.CalledProcessError as e:
print("Failed to compile file " + in_file + ". Command line:")
print()
print(' '.join(shlex.quote(x) for x in compile_cmdline))
print()
sys.exit(55)
# To keep the preprocessed file:
# os._exit(1)
asm_processor.run(asmproc_flags + ['--post-process', out_file, '--assembler', assembler_sh, '--asm-prelude', prelude])
finally:
os.remove(preprocessed_file.name)