diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/utils/llvm-build/llvmbuild/main.py | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/utils/llvm-build/llvmbuild/main.py')
| -rw-r--r-- | gnu/llvm/utils/llvm-build/llvmbuild/main.py | 150 |
1 files changed, 1 insertions, 149 deletions
diff --git a/gnu/llvm/utils/llvm-build/llvmbuild/main.py b/gnu/llvm/utils/llvm-build/llvmbuild/main.py index fccfc7e6ece..4533c650630 100644 --- a/gnu/llvm/utils/llvm-build/llvmbuild/main.py +++ b/gnu/llvm/utils/llvm-build/llvmbuild/main.py @@ -4,7 +4,6 @@ import os import sys import llvmbuild.componentinfo as componentinfo -import llvmbuild.configutil as configutil from llvmbuild.util import fatal, note @@ -38,17 +37,6 @@ def cmake_quote_path(value): return value -def mk_quote_string_for_target(value): - """ - mk_quote_string_for_target(target_name) -> str - - Return a quoted form of the given target_name suitable for including in a - Makefile as a target name. - """ - - # The only quoting we currently perform is for ':', to support msys users. - return value.replace(":", "\\:") - def make_install_dir(path): """ make_install_dir(path) -> None @@ -387,7 +375,7 @@ subdirectories = %s f.write("""\ //===- llvm-build generated file --------------------------------*- C++ -*-===// // -// Component Library Depenedency Table +// Component Library Dependency Table // // Automatically generated file, do not edit! // @@ -651,87 +639,6 @@ set_property(TARGET %s PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES %s)\n""" % ( f.close() - def write_make_fragment(self, output_path, enabled_optional_components): - """ - write_make_fragment(output_path) -> None - - Generate a Makefile fragment which includes all of the collated - LLVMBuild information in a format that is easily digestible by a - Makefile. The exact contents of this are closely tied to how the LLVM - Makefiles integrate LLVMBuild, see Makefile.rules in the top-level. - """ - - dependencies = list(self.get_fragment_dependencies()) - - # Write out the Makefile fragment. - make_install_dir(os.path.dirname(output_path)) - f = open(output_path, 'w') - - # Write the header. - header_fmt = '\ -#===-- %s - LLVMBuild Configuration for LLVM %s-*- Makefile -*--===#' - header_name = os.path.basename(output_path) - header_pad = '-' * (80 - len(header_fmt % (header_name, ''))) - header_string = header_fmt % (header_name, header_pad) - f.write("""\ -%s -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# -# -# This file contains the LLVMBuild project information in a format easily -# consumed by the Makefile based build system. -# -# This file is autogenerated by llvm-build, do not edit! -# -#===------------------------------------------------------------------------===# - -""" % header_string) - - # Write the dependencies for the fragment. - # - # FIXME: Technically, we need to properly quote for Make here. - f.write("""\ -# Clients must explicitly enable LLVMBUILD_INCLUDE_DEPENDENCIES to get -# these dependencies. This is a compromise to help improve the -# performance of recursive Make systems. -""") - f.write('ifeq ($(LLVMBUILD_INCLUDE_DEPENDENCIES),1)\n') - f.write("# The dependencies for this Makefile fragment itself.\n") - f.write("%s: \\\n" % (mk_quote_string_for_target(output_path),)) - for dep in dependencies: - f.write("\t%s \\\n" % (dep,)) - f.write('\n') - - # Generate dummy rules for each of the dependencies, so that things - # continue to work correctly if any of those files are moved or removed. - f.write("""\ -# The dummy targets to allow proper regeneration even when files are moved or -# removed. -""") - for dep in dependencies: - f.write("%s:\n" % (mk_quote_string_for_target(dep),)) - f.write('endif\n') - - f.write(""" -# List of libraries to be exported for use by applications. -# See 'cmake/modules/Makefile'. -LLVM_LIBS_TO_EXPORT :=""") - self.foreach_cmake_library( - lambda ci: - f.write(' \\\n %s' % ci.get_prefixed_library_name()) - , - enabled_optional_components, - skip_disabled = True, - skip_not_installed = True # Do not export internal libraries like gtest - ) - f.write('\n') - f.close() - def add_magic_target_components(parser, project, opts): """add_magic_target_components(project, opts) -> None @@ -853,9 +760,6 @@ def main(): help=( "If given, an alternate path to search for LLVMBuild.txt files"), action="store", default=None, metavar="PATH") - group.add_option("", "--build-root", dest="build_root", metavar="PATH", - help="Path to the build directory (if needed) [%default]", - action="store", default=None) parser.add_option_group(group) group = OptionGroup(parser, "Output Options") @@ -877,18 +781,6 @@ def main(): dest="write_cmake_exports_fragment", metavar="PATH", help="Write the CMake exports information to PATH", action="store", default=None) - group.add_option("", "--write-make-fragment", - dest="write_make_fragment", metavar="PATH", - help="Write the Makefile project information to PATH", - action="store", default=None) - group.add_option("", "--configure-target-def-file", - dest="configure_target_def_files", - help="""Configure the given file at SUBPATH (relative to -the inferred or given source root, and with a '.in' suffix) by replacing certain -substitution variables with lists of targets that support certain features (for -example, targets with AsmPrinters) and write the result to the build root (as -given by --build-root) at the same SUBPATH""", - metavar="SUBPATH", action="append", default=None) parser.add_option_group(group) group = OptionGroup(parser, "Configuration Options") @@ -951,11 +843,6 @@ given by --build-root) at the same SUBPATH""", project_info.write_library_table(opts.write_library_table, opts.optional_components) - # Write out the make fragment, if requested. - if opts.write_make_fragment: - project_info.write_make_fragment(opts.write_make_fragment, - opts.optional_components) - # Write out the cmake fragment, if requested. if opts.write_cmake_fragment: project_info.write_cmake_fragment(opts.write_cmake_fragment, @@ -964,40 +851,5 @@ given by --build-root) at the same SUBPATH""", project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment, opts.optional_components) - # Configure target definition files, if requested. - if opts.configure_target_def_files: - # Verify we were given a build root. - if not opts.build_root: - parser.error("must specify --build-root when using " - "--configure-target-def-file") - - # Create the substitution list. - available_targets = [ci for ci in project_info.component_infos - if ci.type_name == 'TargetGroup'] - substitutions = [ - ("@LLVM_ENUM_TARGETS@", - ' '.join('LLVM_TARGET(%s)' % ci.name - for ci in available_targets)), - ("@LLVM_ENUM_ASM_PRINTERS@", - ' '.join('LLVM_ASM_PRINTER(%s)' % ci.name - for ci in available_targets - if ci.has_asmprinter)), - ("@LLVM_ENUM_ASM_PARSERS@", - ' '.join('LLVM_ASM_PARSER(%s)' % ci.name - for ci in available_targets - if ci.has_asmparser)), - ("@LLVM_ENUM_DISASSEMBLERS@", - ' '.join('LLVM_DISASSEMBLER(%s)' % ci.name - for ci in available_targets - if ci.has_disassembler))] - - # Configure the given files. - for subpath in opts.configure_target_def_files: - inpath = os.path.join(source_root, subpath + '.in') - outpath = os.path.join(opts.build_root, subpath) - result = configutil.configure_file(inpath, outpath, substitutions) - if not result: - note("configured file %r hasn't changed" % outpath) - if __name__=='__main__': main() |
