llvm.org GIT mirror llvm / fe112c2
llvm-build: Adopt generation of LLVM_LIBS_TO_EXPORT. Patch by Brad King. Move `LLVM_LIBS_TO_EXPORT` over to Makefile.llvmbuild and generate it from `llvm-build` using the same logic used to export the dependencies of these libraries. This avoids depending on `llvm-config`. This refactoring was originally motivated by issue #24154 due to commit r243297 (Fix `llvm-config` to emit the linker flag for the combined shared object, 2015-07-27) changing the output of `llvm-config --libs` to not have the individual libraries when we configure with `--enable-shared`. That change was reverted by r244108 but this refactoring makes sense on its own anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245717 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Liew 5 years ago
2 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
77 ##===----------------------------------------------------------------------===##
88
99 LEVEL = ../..
10
11 LINK_COMPONENTS := all
1210
1311 include $(LEVEL)/Makefile.common
1412
3836 LLVM_ENABLE_RTTI := 0
3937 endif
4038
41 # Don't try to run llvm-config during clean because it won't be available
42 ifneq ($(MAKECMDGOALS),clean)
43 LLVM_LIBS_TO_EXPORT := $(subst -l,,$(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error))
44
45 ifeq ($(LLVM_LIBS_TO_EXPORT),Error)
46 $(error llvm-config --libs failed)
47 endif
48
4939 # Strip out gtest and gtest_main from LLVM_LIBS_TO_EXPORT, these are not
5040 # installed and won't be available from the install tree.
51 # FIXME: If we used llvm-config from the install tree this wouldn't be
52 # necessary.
5341 LLVM_LIBS_TO_EXPORT := $(filter-out gtest gtest_main,$(LLVM_LIBS_TO_EXPORT))
5442
5543 ifndef LLVM_LIBS_TO_EXPORT
5644 $(error LLVM_LIBS_TO_EXPORT cannot be empty)
57 endif
5845 endif
5946
6047 OBJMODS := LLVMConfig.cmake LLVMConfigVersion.cmake LLVMExports.cmake
639639
640640 f.close()
641641
642 def write_make_fragment(self, output_path):
642 def write_make_fragment(self, output_path, enabled_optional_components):
643643 """
644644 write_make_fragment(output_path) -> None
645645
704704 for dep in dependencies:
705705 f.write("%s:\n" % (mk_quote_string_for_target(dep),))
706706 f.write('endif\n')
707
708 f.write("""
709 # List of libraries to be exported for use by applications.
710 # See 'cmake/modules/Makefile'.
711 LLVM_LIBS_TO_EXPORT :=""")
712 self.foreach_cmake_library(
713 lambda ci:
714 f.write(' \\\n %s' % ci.get_prefixed_library_name())
715 ,
716 enabled_optional_components,
717 skip_disabled = True
718 )
719 f.write('\n')
707720
708721 f.close()
709722
928941
929942 # Write out the make fragment, if requested.
930943 if opts.write_make_fragment:
931 project_info.write_make_fragment(opts.write_make_fragment)
944 project_info.write_make_fragment(opts.write_make_fragment,
945 opts.optional_components)
932946
933947 # Write out the cmake fragment, if requested.
934948 if opts.write_cmake_fragment: