xref: /freebsd/lib/clang/clang.build.mk (revision 197186496661d8f63639b5b27b33851f727d4da7)
1# $FreeBSD$
2
3CLANG_SRCS=	${LLVM_SRCS}/tools/clang
4
5CFLAGS+=	-I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \
6		-I${LLVM_SRCS}/${SRCDIR} ${INCDIR:C/^/-I${LLVM_SRCS}\//} -I. \
7		-I${LLVM_SRCS}/../../lib/clang/include \
8		-DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \
9		-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG
10
11# LLVM is not strict aliasing safe as of 12/31/2011
12CFLAGS+=	-fno-strict-aliasing
13
14TARGET_ARCH?=	${MACHINE_ARCH}
15BUILD_ARCH?=	${MACHINE_ARCH}
16TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
17BUILD_TRIPLE?=	${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
18CFLAGS+=	-DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \
19		-DLLVM_HOSTTRIPLE=\"${BUILD_TRIPLE}\" \
20		-DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
21CXXFLAGS+=	-fno-exceptions -fno-rtti
22
23.PATH:	${LLVM_SRCS}/${SRCDIR}
24
25TBLGEN?=	tblgen
26CLANG_TBLGEN?=	clang-tblgen
27TBLINC+=	-I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target
28
29Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/Intrinsics.td
30	${TBLGEN} -I ${LLVM_SRCS}/lib/VMCore ${TBLINC} -gen-intrinsic \
31	    -o ${.TARGET} ${LLVM_SRCS}/include/llvm/Intrinsics.td
32.for arch in \
33	ARM/ARM Mips/Mips PowerPC/PPC X86/X86
34. for hdr in \
35	AsmMatcher/-gen-asm-matcher \
36	AsmWriter1/-gen-asm-writer,-asmwriternum=1 \
37	AsmWriter/-gen-asm-writer \
38	CallingConv/-gen-callingconv \
39	CodeEmitter/-gen-emitter \
40	DAGISel/-gen-dag-isel \
41	DisassemblerTables/-gen-disassembler \
42	EDInfo/-gen-enhanced-disassembly-info \
43	FastISel/-gen-fast-isel \
44	InstrInfo/-gen-instr-info \
45	MCCodeEmitter/-gen-emitter,-mc-emitter \
46	MCPseudoLowering/-gen-pseudo-lowering \
47	RegisterInfo/-gen-register-info \
48	SubtargetInfo/-gen-subtarget
49${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
50	${TBLGEN} -I ${LLVM_SRCS}/lib/Target/${arch:H} ${TBLINC} \
51	    ${hdr:T:C/,/ /g} -o ${.TARGET} \
52	    ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
53. endfor
54.endfor
55
56Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
57	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
58	    -gen-clang-attr-classes -o ${.TARGET} \
59	    -I ${CLANG_SRCS}/include ${.ALLSRC}
60
61AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
62	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
63	    -gen-clang-attr-impl -o ${.TARGET} \
64	    -I ${CLANG_SRCS}/include ${.ALLSRC}
65
66AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
67	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
68	    -gen-clang-attr-late-parsed-list -o ${.TARGET} \
69	    -I ${CLANG_SRCS}/include ${.ALLSRC}
70
71AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
72	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
73	    -gen-clang-attr-list -o ${.TARGET} \
74	    -I ${CLANG_SRCS}/include ${.ALLSRC}
75
76AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
77	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
78	    -gen-clang-attr-parsed-attr-kinds -o ${.TARGET} \
79	    -I ${CLANG_SRCS}/include ${.ALLSRC}
80
81AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
82	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
83	    -gen-clang-attr-parsed-attr-list -o ${.TARGET} \
84	    -I ${CLANG_SRCS}/include ${.ALLSRC}
85
86AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
87	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Serialization \
88	    ${TBLINC} -gen-clang-attr-pch-read -o ${.TARGET} \
89	    -I ${CLANG_SRCS}/include ${.ALLSRC}
90
91AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
92	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Serialization \
93	    ${TBLINC} -gen-clang-attr-pch-write -o ${.TARGET} \
94	    -I ${CLANG_SRCS}/include ${.ALLSRC}
95
96AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
97	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Lex ${TBLINC} \
98	    -gen-clang-attr-spelling-list -o ${.TARGET} \
99	    -I ${CLANG_SRCS}/include ${.ALLSRC}
100
101AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
102	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
103	    -gen-clang-attr-template-instantiate -o ${.TARGET} \
104	    -I ${CLANG_SRCS}/include ${.ALLSRC}
105
106CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td
107	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
108	    -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC}
109
110CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
111	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
112	    -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC}
113
114CommentHTMLTagsProperties.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
115	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
116	    -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC}
117
118CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td
119	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
120	    -gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC}
121
122DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td
123	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
124	    -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC}
125
126StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td
127	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
128	    -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC}
129
130arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td
131	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
132	    -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC}
133
134DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
135	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
136	    -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC}
137
138DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
139	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
140	    -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC}
141
142.for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization
143Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
144	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
145	    -gen-clang-diags-defs -clang-component=${hdr} \
146	    -o ${.TARGET} ${.ALLSRC}
147.endfor
148
149Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td
150	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \
151	    -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC}
152
153CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td
154	${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \
155	    -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC}
156
157Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \
158	    ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td
159	${CLANG_TBLGEN} -I ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers \
160	    ${TBLINC} -gen-clang-sa-checkers -o ${.TARGET} \
161	    -I ${CLANG_SRCS}/include \
162	    ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td
163
164SRCS+=		${TGHDRS:C/$/.inc.h/}
165DPADD+=		${TGHDRS:C/$/.inc.h/}
166CLEANFILES+=	${TGHDRS:C/$/.inc.h/}
167