Makefile revision 7d2b8c1fcc2b707be78b09930a7767477822462f
1CLANG_LEVEL := ../../..
2BUILT_SOURCES = \
3	DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
4	DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
5	DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
6	DiagnosticParseKinds.inc DiagnosticSemaKinds.inc \
7	DiagnosticIndexName.inc DiagnosticGroups.inc AttrList.inc arm_neon.inc \
8	Version.inc
9
10TABLEGEN_INC_FILES_COMMON = 1
11
12include $(CLANG_LEVEL)/Makefile
13
14INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
15
16# Compute the Clang version from the LLVM version, unless specified explicitly.
17ifndef CLANG_VERSION
18CLANG_VERSION := $(subst svn,,$(LLVMVersion))
19CLANG_VERSION := $(subst rc,,$(CLANG_VERSION))
20endif
21
22CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION))
23CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS))
24CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS))
25CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS))
26ifeq ($(CLANG_VERSION_PATCHLEVEL),)
27CLANG_HAS_VERSION_PATCHLEVEL := 0
28else
29CLANG_HAS_VERSION_PATCHLEVEL := 1
30endif
31
32$(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td Diagnostic%Kinds.td $(TBLGEN) $(ObjDir)/.dir
33	$(Echo) "Building Clang $(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) diagnostic tables with tblgen"
34	$(Verb) $(TableGen) -gen-clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) -o $(call SYSPATH, $@) $<
35
36$(ObjDir)/DiagnosticIndexName.inc.tmp : Diagnostic.td $(INPUT_TDS) $(TBLGEN) $(ObjDir)/.dir
37	$(Echo) "Building Clang diagnostic name index with tblgen"
38	$(Verb) $(TableGen) -gen-clang-diags-index-name -o $(call SYSPATH, $@) $<
39
40$(ObjDir)/DiagnosticGroups.inc.tmp : Diagnostic.td DiagnosticGroups.td $(INPUT_TDS) $(TBLGEN) $(ObjDir)/.dir
41	$(Echo) "Building Clang diagnostic groups with tblgen"
42	$(Verb) $(TableGen) -gen-clang-diag-groups -o $(call SYSPATH, $@) $<
43
44$(ObjDir)/AttrList.inc.tmp : Attr.td $(TBLGEN) $(ObjDir)/.dir
45	$(Echo) "Building Clang attribute list with tblgen"
46	$(Verb) $(TableGen) -gen-clang-attr-list -o $(call SYSPATH, $@) \
47	  -I $(PROJ_SRC_DIR)/../.. $<
48
49$(ObjDir)/arm_neon.inc.tmp : arm_neon.td $(TBLGEN) $(ObjDir)/.dir
50	$(Echo) "Building Clang arm_neon.inc with tblgen"
51	$(Verb) $(TableGen) -gen-arm-neon-sema -o $(call SYSPATH, $@) $<
52
53$(ObjDir)/Version.inc.tmp : Version.inc.in Makefile $(LLVM_OBJ_ROOT)/Makefile.config $(ObjDir)/.dir
54	$(Echo) "Updating Clang version info."
55	$(Verb)sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \
56	           -e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \
57	           -e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \
58	           -e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \
59	           -e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
60	           $< > $@
61