1###################################4########################
2## TableGen: Compile .td files to .inc.
3###########################################################
4ifeq ($(LOCAL_MODULE_CLASS),)
5    LOCAL_MODULE_CLASS := STATIC_LIBRARIES
6endif
7
8ifneq ($(strip $(TBLGEN_TABLES)),)
9
10define transform-clang-td-to-out
11$(if $(LOCAL_IS_HOST_MODULE),	\
12	$(call transform-host-clang-td-to-out,$(1)),	\
13	$(call transform-device-clang-td-to-out,$(1)))
14endef
15
16define transform-td-to-out
17$(if $(LOCAL_IS_HOST_MODULE),	\
18	$(call transform-host-td-to-out,$(1)),	\
19	$(call transform-device-td-to-out,$(1)))
20endef
21
22generated_sources := $(call local-generated-sources-dir)
23
24ifneq ($(findstring AttrDump.inc,$(TBLGEN_TABLES)),)
25LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/AttrDump.inc
26$(generated_sources)/include/clang/AST/AttrDump.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
27$(generated_sources)/include/clang/AST/AttrDump.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
28	$(call transform-clang-td-to-out,clang-attr-dump)
29endif
30
31ifneq ($(findstring AttrImpl.inc,$(TBLGEN_TABLES)),)
32LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/AttrImpl.inc
33$(generated_sources)/include/clang/AST/AttrImpl.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
34$(generated_sources)/include/clang/AST/AttrImpl.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
35	$(call transform-clang-td-to-out,clang-attr-impl)
36endif
37
38ifneq ($(findstring AttrHasAttributeImpl.inc,$(TBLGEN_TABLES)),)
39LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Basic/AttrHasAttributeImpl.inc
40$(generated_sources)/include/clang/Basic/AttrHasAttributeImpl.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
41$(generated_sources)/include/clang/Basic/AttrHasAttributeImpl.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
42	$(call transform-clang-td-to-out,clang-attr-has-attribute-impl)
43endif
44
45ifneq ($(findstring AttrList.inc,$(TBLGEN_TABLES)),)
46LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Basic/AttrList.inc
47$(generated_sources)/include/clang/Basic/AttrList.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
48$(generated_sources)/include/clang/Basic/AttrList.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
49	$(call transform-clang-td-to-out,clang-attr-list)
50endif
51
52ifneq ($(findstring AttrSpellingListIndex.inc,$(TBLGEN_TABLES)),)
53LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Sema/AttrSpellingListIndex.inc
54$(generated_sources)/include/clang/Sema/AttrSpellingListIndex.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
55$(generated_sources)/include/clang/Sema/AttrSpellingListIndex.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
56	$(call transform-clang-td-to-out,clang-attr-spelling-index)
57endif
58
59ifneq ($(findstring AttrPCHRead.inc,$(TBLGEN_TABLES)),)
60LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Serialization/AttrPCHRead.inc
61$(generated_sources)/include/clang/Serialization/AttrPCHRead.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
62$(generated_sources)/include/clang/Serialization/AttrPCHRead.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
63	$(call transform-clang-td-to-out,clang-attr-pch-read)
64endif
65
66ifneq ($(findstring AttrPCHWrite.inc,$(TBLGEN_TABLES)),)
67LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Serialization/AttrPCHWrite.inc
68$(generated_sources)/include/clang/Serialization/AttrPCHWrite.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
69$(generated_sources)/include/clang/Serialization/AttrPCHWrite.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
70	$(call transform-clang-td-to-out,clang-attr-pch-write)
71endif
72
73ifneq ($(findstring Attrs.inc,$(TBLGEN_TABLES)),)
74LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/Attrs.inc
75$(generated_sources)/include/clang/AST/Attrs.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
76$(generated_sources)/include/clang/AST/Attrs.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
77	$(call transform-clang-td-to-out,clang-attr-classes)
78endif
79
80ifneq ($(findstring AttrParserStringSwitches.inc,$(TBLGEN_TABLES)),)
81LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Parse/AttrParserStringSwitches.inc
82$(generated_sources)/include/clang/Parse/AttrParserStringSwitches.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
83$(generated_sources)/include/clang/Parse/AttrParserStringSwitches.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
84	$(call transform-clang-td-to-out,clang-attr-parser-string-switches)
85endif
86
87ifneq ($(findstring AttrVisitor.inc,$(TBLGEN_TABLES)),)
88LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/AttrVisitor.inc
89$(generated_sources)/include/clang/AST/AttrVisitor.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
90$(generated_sources)/include/clang/AST/AttrVisitor.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
91	$(call transform-clang-td-to-out,clang-attr-ast-visitor)
92endif
93
94ifneq ($(findstring AttrParsedAttrKinds.inc,$(TBLGEN_TABLES)),)
95LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Sema/AttrParsedAttrKinds.inc
96$(generated_sources)/include/clang/Sema/AttrParsedAttrKinds.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
97$(generated_sources)/include/clang/Sema/AttrParsedAttrKinds.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
98	$(call transform-clang-td-to-out,clang-attr-parsed-attr-kinds)
99endif
100
101ifneq ($(findstring AttrParsedAttrImpl.inc,$(TBLGEN_TABLES)),)
102LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Sema/AttrParsedAttrImpl.inc
103$(generated_sources)/include/clang/Sema/AttrParsedAttrImpl.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
104$(generated_sources)/include/clang/Sema/AttrParsedAttrImpl.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
105	$(call transform-clang-td-to-out,clang-attr-parsed-attr-impl)
106endif
107
108ifneq ($(findstring AttrParsedAttrList.inc,$(TBLGEN_TABLES)),)
109LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Sema/AttrParsedAttrList.inc
110$(generated_sources)/include/clang/Sema/AttrParsedAttrList.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
111$(generated_sources)/include/clang/Sema/AttrParsedAttrList.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
112	$(call transform-clang-td-to-out,clang-attr-parsed-attr-list)
113endif
114
115ifneq ($(findstring AttrTemplateInstantiate.inc,$(TBLGEN_TABLES)),)
116LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Sema/AttrTemplateInstantiate.inc
117$(generated_sources)/include/clang/Sema/AttrTemplateInstantiate.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
118$(generated_sources)/include/clang/Sema/AttrTemplateInstantiate.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
119	$(call transform-clang-td-to-out,clang-attr-template-instantiate)
120endif
121
122ifneq ($(findstring Checkers.inc,$(TBLGEN_TABLES)),)
123LOCAL_GENERATED_SOURCES += $(generated_sources)/Checkers.inc
124$(generated_sources)/Checkers.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
125$(generated_sources)/Checkers.inc: \
126  $(CLANG_ROOT_PATH)/lib/StaticAnalyzer/Checkers/Checkers.td \
127  $(CLANG_ROOT_PATH)/include/clang/StaticAnalyzer/Checkers/CheckerBase.td \
128  $(CLANG_TBLGEN)
129	$(call transform-clang-td-to-out,clang-sa-checkers)
130endif
131
132ifneq ($(findstring CommentCommandInfo.inc,$(TBLGEN_TABLES)),)
133LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/CommentCommandInfo.inc
134$(generated_sources)/include/clang/AST/CommentCommandInfo.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
135$(generated_sources)/include/clang/AST/CommentCommandInfo.inc: \
136  $(CLANG_ROOT_PATH)/include/clang/AST/CommentCommands.td \
137  $(CLANG_TBLGEN)
138	$(call transform-clang-td-to-out,clang-comment-command-info)
139endif
140
141ifneq ($(findstring CommentCommandList.inc,$(TBLGEN_TABLES)),)
142LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/CommentCommandList.inc
143$(generated_sources)/include/clang/AST/CommentCommandList.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
144$(generated_sources)/include/clang/AST/CommentCommandList.inc: \
145  $(CLANG_ROOT_PATH)/include/clang/AST/CommentCommands.td \
146  $(CLANG_TBLGEN)
147	$(call transform-clang-td-to-out,clang-comment-command-list)
148endif
149
150ifneq ($(findstring CommentHTMLNamedCharacterReferences.inc,$(TBLGEN_TABLES)),)
151LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/CommentHTMLNamedCharacterReferences.inc
152$(generated_sources)/include/clang/AST/CommentHTMLNamedCharacterReferences.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
153$(generated_sources)/include/clang/AST/CommentHTMLNamedCharacterReferences.inc: \
154  $(CLANG_ROOT_PATH)/include/clang/AST/CommentHTMLNamedCharacterReferences.td \
155  $(CLANG_TBLGEN)
156	$(call transform-clang-td-to-out,clang-comment-html-named-character-references)
157endif
158
159ifneq ($(findstring CommentHTMLTagsProperties.inc,$(TBLGEN_TABLES)),)
160LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/CommentHTMLTagsProperties.inc
161$(generated_sources)/include/clang/AST/CommentHTMLTagsProperties.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
162$(generated_sources)/include/clang/AST/CommentHTMLTagsProperties.inc: \
163  $(CLANG_ROOT_PATH)/include/clang/AST/CommentHTMLTags.td \
164  $(CLANG_TBLGEN)
165	$(call transform-clang-td-to-out,clang-comment-html-tags-properties)
166endif
167
168ifneq ($(findstring CommentHTMLTags.inc,$(TBLGEN_TABLES)),)
169LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/CommentHTMLTags.inc
170$(generated_sources)/include/clang/AST/CommentHTMLTags.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
171$(generated_sources)/include/clang/AST/CommentHTMLTags.inc: \
172  $(CLANG_ROOT_PATH)/include/clang/AST/CommentHTMLTags.td \
173  $(CLANG_TBLGEN)
174	$(call transform-clang-td-to-out,clang-comment-html-tags)
175endif
176
177ifneq ($(findstring CommentNodes.inc,$(TBLGEN_TABLES)),)
178LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/CommentNodes.inc
179$(generated_sources)/include/clang/AST/CommentNodes.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
180$(generated_sources)/include/clang/AST/CommentNodes.inc: \
181  $(CLANG_ROOT_PATH)/include/clang/Basic/CommentNodes.td \
182  $(CLANG_TBLGEN)
183	$(call transform-clang-td-to-out,clang-comment-nodes)
184endif
185
186ifneq ($(filter Diagnostic%Kinds.inc,$(TBLGEN_TABLES)),)
187LOCAL_GENERATED_SOURCES += $(addprefix $(generated_sources)/include/clang/Basic/,$(filter Diagnostic%Kinds.inc,$(TBLGEN_TABLES)))
188$(generated_sources)/include/clang/Basic/Diagnostic%Kinds.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
189$(generated_sources)/include/clang/Basic/Diagnostic%Kinds.inc: \
190  $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td \
191  $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic%Kinds.td \
192  $(CLANG_TBLGEN)
193	$(call transform-clang-td-to-out,clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc,%,$(@F)))
194endif
195
196ifneq ($(findstring DiagnosticGroups.inc,$(TBLGEN_TABLES)),)
197LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Basic/DiagnosticGroups.inc
198$(generated_sources)/include/clang/Basic/DiagnosticGroups.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
199$(generated_sources)/include/clang/Basic/DiagnosticGroups.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_ROOT_PATH)/include/clang/Basic/DiagnosticGroups.td $(CLANG_TBLGEN)
200	$(call transform-clang-td-to-out,clang-diag-groups)
201endif
202
203ifneq ($(findstring DiagnosticIndexName.inc,$(TBLGEN_TABLES)),)
204LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Basic/DiagnosticIndexName.inc
205$(generated_sources)/include/clang/Basic/DiagnosticIndexName.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
206$(generated_sources)/include/clang/Basic/DiagnosticIndexName.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_TBLGEN)
207	$(call transform-clang-td-to-out,clang-diag-groups)
208endif
209
210ifneq ($(findstring DeclNodes.inc,$(TBLGEN_TABLES)),)
211LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/DeclNodes.inc
212$(generated_sources)/include/clang/AST/DeclNodes.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
213$(generated_sources)/include/clang/AST/DeclNodes.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/DeclNodes.td $(CLANG_TBLGEN)
214	$(call transform-clang-td-to-out,clang-decl-nodes)
215endif
216
217ifneq ($(findstring StmtNodes.inc,$(TBLGEN_TABLES)),)
218LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/AST/StmtNodes.inc
219$(generated_sources)/include/clang/AST/StmtNodes.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
220$(generated_sources)/include/clang/AST/StmtNodes.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/StmtNodes.td $(CLANG_TBLGEN)
221	$(call transform-clang-td-to-out,clang-stmt-nodes)
222endif
223
224ifneq ($(findstring arm_neon.inc,$(TBLGEN_TABLES)),)
225LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Basic/arm_neon.inc
226$(generated_sources)/include/clang/Basic/arm_neon.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
227$(generated_sources)/include/clang/Basic/arm_neon.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/arm_neon.td $(CLANG_TBLGEN)
228	$(call transform-clang-td-to-out,arm-neon-sema)
229endif
230
231ifneq ($(findstring Options.inc,$(TBLGEN_TABLES)),)
232LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Driver/Options.inc
233$(generated_sources)/include/clang/Driver/Options.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
234$(generated_sources)/include/clang/Driver/Options.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/Options.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(CLANG_ROOT_PATH)/include/clang/Driver/CC1Options.td \
235    $(CLANG_TBLGEN) $(LLVM_TBLGEN)
236	$(call transform-td-to-out,opt-parser-defs)
237endif
238
239ifneq ($(findstring arm_neon.h,$(TBLGEN_TABLES)),)
240LOCAL_GENERATED_SOURCES += $(generated_sources)/include/clang/Basic/arm_neon.h
241$(generated_sources)/include/clang/Basic/arm_neon.h: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
242$(generated_sources)/include/clang/Basic/arm_neon.h: $(CLANG_ROOT_PATH)/include/clang/Basic/arm_neon.td $(CLANG_TBLGEN)
243	$(call transform-clang-td-to-out,arm-neon)
244endif
245
246LOCAL_C_INCLUDES += $(generated_sources)/include
247
248endif
249