llvm.org GIT mirror llvm / 36c8c50
Remove llvm-build's --write-make-fragment which looks like a remnant from the autoconf build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329191 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 2 years ago
1 changed file(s) with 0 addition(s) and 101 deletion(s). Raw diff Collapse all Expand all
3636 value = value.replace("\\", "/")
3737
3838 return value
39
40 def mk_quote_string_for_target(value):
41 """
42 mk_quote_string_for_target(target_name) -> str
43
44 Return a quoted form of the given target_name suitable for including in a
45 Makefile as a target name.
46 """
47
48 # The only quoting we currently perform is for ':', to support msys users.
49 return value.replace(":", "\\:")
5039
5140 def make_install_dir(path):
5241 """
650639
651640 f.close()
652641
653 def write_make_fragment(self, output_path, enabled_optional_components):
654 """
655 write_make_fragment(output_path) -> None
656
657 Generate a Makefile fragment which includes all of the collated
658 LLVMBuild information in a format that is easily digestible by a
659 Makefile. The exact contents of this are closely tied to how the LLVM
660 Makefiles integrate LLVMBuild, see Makefile.rules in the top-level.
661 """
662
663 dependencies = list(self.get_fragment_dependencies())
664
665 # Write out the Makefile fragment.
666 make_install_dir(os.path.dirname(output_path))
667 f = open(output_path, 'w')
668
669 # Write the header.
670 header_fmt = '\
671 #===-- %s - LLVMBuild Configuration for LLVM %s-*- Makefile -*--===#'
672 header_name = os.path.basename(output_path)
673 header_pad = '-' * (80 - len(header_fmt % (header_name, '')))
674 header_string = header_fmt % (header_name, header_pad)
675 f.write("""\
676 %s
677 #
678 # The LLVM Compiler Infrastructure
679 #
680 # This file is distributed under the University of Illinois Open Source
681 # License. See LICENSE.TXT for details.
682 #
683 #===------------------------------------------------------------------------===#
684 #
685 # This file contains the LLVMBuild project information in a format easily
686 # consumed by the Makefile based build system.
687 #
688 # This file is autogenerated by llvm-build, do not edit!
689 #
690 #===------------------------------------------------------------------------===#
691
692 """ % header_string)
693
694 # Write the dependencies for the fragment.
695 #
696 # FIXME: Technically, we need to properly quote for Make here.
697 f.write("""\
698 # Clients must explicitly enable LLVMBUILD_INCLUDE_DEPENDENCIES to get
699 # these dependencies. This is a compromise to help improve the
700 # performance of recursive Make systems.
701 """)
702 f.write('ifeq ($(LLVMBUILD_INCLUDE_DEPENDENCIES),1)\n')
703 f.write("# The dependencies for this Makefile fragment itself.\n")
704 f.write("%s: \\\n" % (mk_quote_string_for_target(output_path),))
705 for dep in dependencies:
706 f.write("\t%s \\\n" % (dep,))
707 f.write('\n')
708
709 # Generate dummy rules for each of the dependencies, so that things
710 # continue to work correctly if any of those files are moved or removed.
711 f.write("""\
712 # The dummy targets to allow proper regeneration even when files are moved or
713 # removed.
714 """)
715 for dep in dependencies:
716 f.write("%s:\n" % (mk_quote_string_for_target(dep),))
717 f.write('endif\n')
718
719 f.write("""
720 # List of libraries to be exported for use by applications.
721 # See 'cmake/modules/Makefile'.
722 LLVM_LIBS_TO_EXPORT :=""")
723 self.foreach_cmake_library(
724 lambda ci:
725 f.write(' \\\n %s' % ci.get_prefixed_library_name())
726 ,
727 enabled_optional_components,
728 skip_disabled = True,
729 skip_not_installed = True # Do not export internal libraries like gtest
730 )
731 f.write('\n')
732 f.close()
733
734642 def add_magic_target_components(parser, project, opts):
735643 """add_magic_target_components(project, opts) -> None
736644
876784 dest="write_cmake_exports_fragment", metavar="PATH",
877785 help="Write the CMake exports information to PATH",
878786 action="store", default=None)
879 group.add_option("", "--write-make-fragment",
880 dest="write_make_fragment", metavar="PATH",
881 help="Write the Makefile project information to PATH",
882 action="store", default=None)
883787 group.add_option("", "--configure-target-def-file",
884788 dest="configure_target_def_files",
885789 help="""Configure the given file at SUBPATH (relative to
948852 # Write out the required library table, if requested.
949853 if opts.write_library_table:
950854 project_info.write_library_table(opts.write_library_table,
951 opts.optional_components)
952
953 # Write out the make fragment, if requested.
954 if opts.write_make_fragment:
955 project_info.write_make_fragment(opts.write_make_fragment,
956855 opts.optional_components)
957856
958857 # Write out the cmake fragment, if requested.