From 177a119621f14a6ced87982ada75372815b636cf Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 15 May 2012 18:44:12 +0000 Subject: [PATCH] llvm-build: Don't emit library information for disabled targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156837 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/llvm-build/llvmbuild/componentinfo.py | 15 +++++++++++++++ utils/llvm-build/llvmbuild/main.py | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py index 737b857dfbb..c32cc1aeb06 100644 --- a/utils/llvm-build/llvmbuild/componentinfo.py +++ b/utils/llvm-build/llvmbuild/componentinfo.py @@ -68,6 +68,21 @@ class ComponentInfo(object): def get_llvmbuild_fragment(self): abstract + def get_parent_target_group(self): + """get_parent_target_group() -> ComponentInfo or None + + Return the nearest parent target group (if any), or None if the + component is not part of any target group. + """ + + # If this is a target group, return it. + if self.type_name == 'TargetGroup': + return self + + # Otherwise recurse on the parent, if any. + if self.parent_instance: + return self.parent_instance.get_parent_target_group() + class GroupComponentInfo(ComponentInfo): """ Group components have no semantics as far as the build system are concerned, diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py index 2be9cd6b446..48b59bdac38 100644 --- a/utils/llvm-build/llvmbuild/main.py +++ b/utils/llvm-build/llvmbuild/main.py @@ -319,11 +319,16 @@ subdirectories = %s # dependencies for added library groups. entries = {} for c in self.ordered_component_infos: - # Skip optional components which are not enabled + # Skip optional components which are not enabled. if c.type_name == 'OptionalLibrary' \ and c.name not in enabled_optional_components: continue + # Skip target groups which are not enabled. + tg = c.get_parent_target_group() + if tg and not tg.enabled: + continue + # Only certain components are in the table. if c.type_name not in ('Library', 'OptionalLibrary', \ 'LibraryGroup', 'TargetGroup'): -- 2.34.1