Beispiel #1
0
    if x in ['-g3', '-g', '-O1', '-O2', '-framepointer']
]

preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed',
                                                suffix='.c',
                                                delete=False)

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
    ]

    functions, deps = 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
    ],
Beispiel #2
0
    if x in ['-g3', '-g', '-O1', '-O2', '-framepointer']
]

preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed',
                                                suffix='.c',
                                                delete=False)

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()
        # To keep the preprocessed file:
        # os._exit(1)

    asm_processor.run(asmproc_flags + [
        '--post-process', out_file, '--assembler', assembler_sh,
        '--asm-prelude', prelude
    ])
finally:
Beispiel #3
0
# resulting .o files much smaller and speeds up builds, but loses line
# number debug data.
# asmproc_flags += ["--drop-mdebug-gptab"]

# Convert encoding before compiling.
# asmproc_flags += ["--input-enc", "utf-8", "--output-enc", "euc-jp"]

preprocessed_file = tempfile.NamedTemporaryFile(prefix="preprocessed",
                                                suffix=".c",
                                                delete=False)

try:
    compile_cmdline = (compiler + compile_args +
                       ["-I", in_dir, "-o", out_file, preprocessed_file.name])

    functions, deps = 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,