MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / compile_source_file

Function compile_source_file

emcc.py:562–588  ·  view source on GitHub ↗
(input_file)

Source from the content-addressed store, hash-verified

560 return in_temp(uniquename(objfile))
561
562 def compile_source_file(input_file):
563 logger.debug(f'compiling source file: {input_file}')
564 output_file = get_object_filename(input_file)
565 ext = get_file_suffix(input_file)
566 if ext in ASSEMBLY_EXTENSIONS:
567 cmd = get_clang_command_asm()
568 elif ext in PREPROCESSED_EXTENSIONS:
569 cmd = get_clang_command_preprocessed()
570 else:
571 cmd = get_clang_command()
572 if ext == '.pcm':
573 cmd = [c for c in cmd if not c.startswith('-fprebuilt-module-path=')]
574 cmd += [*compile_args, '-c', input_file, '-o', output_file]
575 if options.requested_debug == '-gsplit-dwarf':
576 # When running in COMPILE_AND_LINK mode we compile objects to a temporary location
577 # but we want the `.dwo` file to be generated in the current working directory,
578 # like it is under clang. We could avoid this hack if we use the clang driver
579 # to generate the temporary files, but that would also involve using the clang
580 # driver to perform linking which would be a big change.
581 cmd += ['-Xclang', '-split-dwarf-file', '-Xclang', unsuffixed_basename(input_file) + '.dwo']
582 cmd += ['-Xclang', '-split-dwarf-output', '-Xclang', unsuffixed_basename(input_file) + '.dwo']
583 shared.check_call(cmd)
584 if not shared.SKIP_SUBPROCS:
585 assert os.path.exists(output_file)
586 if options.save_temps:
587 shutil.copyfile(output_file, utils.unsuffixed_basename(input_file) + '.o')
588 return output_file
589
590 # Compile input files individually to temporary locations.
591 for arg in linker_args:

Callers 1

phase_compile_inputsFunction · 0.85

Calls 7

get_file_suffixFunction · 0.90
unsuffixed_basenameFunction · 0.90
get_object_filenameFunction · 0.85
get_clang_command_asmFunction · 0.85
get_clang_commandFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected