Makefile revision 461ed44afac0aa56810e9f870d51692ee4ab235b
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	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)/DiagnosticGroups.inc.tmp : Diagnostic.td DiagnosticGroups.td $(INPUT_TDS) $(TBLGEN) $(ObjDir)/.dir
37	$(Echo) "Building Clang diagnostic groups with tblgen"
38	$(Verb) $(TableGen) -gen-clang-diag-groups -o $(call SYSPATH, $@) $<
39
40$(ObjDir)/AttrList.inc.tmp : Attr.td $(TBLGEN) $(ObjDir)/.dir
41	$(Echo) "Building Clang attribute list with tblgen"
42	$(Verb) $(TableGen) -gen-clang-attr-list -o $(call SYSPATH, $@) \
43	  -I $(PROJ_SRC_DIR)/../.. $<
44
45$(ObjDir)/arm_neon.inc.tmp : arm_neon.td $(TBLGEN) $(ObjDir)/.dir
46	$(Echo) "Building Clang arm_neon.inc with tblgen"
47	$(Verb) $(TableGen) -gen-arm-neon-sema -o $(call SYSPATH, $@) $<
48
49$(ObjDir)/Version.inc.tmp : Version.inc.in Makefile $(LLVM_OBJ_ROOT)/Makefile.config $(ObjDir)/.dir
50	$(Echo) "Updating Clang version info."
51	$(Verb)sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \
52	           -e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \
53	           -e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \
54	           -e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \
55	           -e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
56	           $< > $@
57