]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - lib/clang/clang.build.mk
MFC r266053:
[FreeBSD/stable/10.git] / lib / clang / clang.build.mk
1 # $FreeBSD$
2
3 CLANG_SRCS=     ${LLVM_SRCS}/tools/clang
4
5 CFLAGS+=        -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 .if !defined(EARLY_BUILD) && defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no"
12 CFLAGS+=        -DCLANG_ENABLE_ARCMT \
13                 -DCLANG_ENABLE_REWRITER \
14                 -DCLANG_ENABLE_STATIC_ANALYZER
15 .endif # !EARLY_BUILD && MK_CLANG_FULL
16
17 # LLVM is not strict aliasing safe as of 12/31/2011
18 CFLAGS+=        -fno-strict-aliasing
19
20 TARGET_ARCH?=   ${MACHINE_ARCH}
21 BUILD_ARCH?=    ${MACHINE_ARCH}
22
23 .if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
24     ${MK_ARM_EABI} != "no"
25 TARGET_ABI=     gnueabi
26 .else
27 TARGET_ABI=     unknown
28 .endif
29
30 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0
31 BUILD_TRIPLE?=  ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
32 CFLAGS+=        -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \
33                 -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" \
34                 -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
35 CXXFLAGS+=      -fno-exceptions -fno-rtti
36
37 .PATH:  ${LLVM_SRCS}/${SRCDIR}
38
39 TBLGEN?=        tblgen
40 CLANG_TBLGEN?=  clang-tblgen
41
42 Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td
43         ${TBLGEN} -gen-intrinsic \
44             -I ${LLVM_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
45             ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td
46 .for arch in \
47         ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86
48 . for hdr in \
49         AsmMatcher/-gen-asm-matcher \
50         AsmWriter1/-gen-asm-writer,-asmwriternum=1 \
51         AsmWriter/-gen-asm-writer \
52         CallingConv/-gen-callingconv \
53         CodeEmitter/-gen-emitter \
54         DAGISel/-gen-dag-isel \
55         DisassemblerTables/-gen-disassembler \
56         FastISel/-gen-fast-isel \
57         InstrInfo/-gen-instr-info \
58         MCCodeEmitter/-gen-emitter,-mc-emitter \
59         MCPseudoLowering/-gen-pseudo-lowering \
60         RegisterInfo/-gen-register-info \
61         SubtargetInfo/-gen-subtarget
62 ${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
63         ${TBLGEN} ${hdr:T:C/,/ /g} \
64             -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \
65             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
66             ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
67 . endfor
68 .endfor
69
70 Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
71         ${CLANG_TBLGEN} -gen-clang-attr-classes \
72             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
73             ${.ALLSRC}
74
75 AttrDump.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
76         ${CLANG_TBLGEN} -gen-clang-attr-dump \
77             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
78             ${.ALLSRC}
79
80 AttrIdentifierArg.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
81         ${CLANG_TBLGEN} -gen-clang-attr-identifier-arg-list \
82             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
83             ${.ALLSRC}
84
85 AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
86         ${CLANG_TBLGEN} -gen-clang-attr-impl \
87             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
88             ${.ALLSRC}
89
90 AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
91         ${CLANG_TBLGEN} -gen-clang-attr-late-parsed-list \
92             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
93             ${.ALLSRC}
94
95 AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
96         ${CLANG_TBLGEN} -gen-clang-attr-list \
97             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
98             ${.ALLSRC}
99
100 AttrParsedAttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
101         ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-impl \
102             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
103             ${.ALLSRC}
104
105 AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
106         ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-kinds \
107             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
108             ${.ALLSRC}
109
110 AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
111         ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-list \
112             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
113             ${.ALLSRC}
114
115 AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
116         ${CLANG_TBLGEN} -gen-clang-attr-pch-read \
117             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
118             ${.ALLSRC}
119
120 AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
121         ${CLANG_TBLGEN} -gen-clang-attr-pch-write \
122             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
123             ${.ALLSRC}
124
125 AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
126         ${CLANG_TBLGEN} -gen-clang-attr-spelling-list \
127             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
128             ${.ALLSRC}
129
130 AttrSpellingListIndex.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
131         ${CLANG_TBLGEN} -gen-clang-attr-spelling-index \
132             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
133             ${.ALLSRC}
134
135 AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
136         ${CLANG_TBLGEN} -gen-clang-attr-template-instantiate \
137             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
138             ${.ALLSRC}
139
140 AttrTypeArg.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
141         ${CLANG_TBLGEN} -gen-clang-attr-type-arg-list \
142             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
143             ${.ALLSRC}
144
145 CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td
146         ${CLANG_TBLGEN} -gen-clang-comment-command-info \
147             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
148
149 CommentCommandList.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td
150         ${CLANG_TBLGEN} -gen-clang-comment-command-list \
151             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
152
153 CommentHTMLNamedCharacterReferences.inc.h: \
154         ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td
155         ${CLANG_TBLGEN} -gen-clang-comment-html-named-character-references \
156             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
157
158 CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
159         ${CLANG_TBLGEN} -gen-clang-comment-html-tags \
160             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
161
162 CommentHTMLTagsProperties.inc.h: \
163         ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
164         ${CLANG_TBLGEN} -gen-clang-comment-html-tags-properties \
165             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
166
167 CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td
168         ${CLANG_TBLGEN} -gen-clang-comment-nodes \
169             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
170
171 DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td
172         ${CLANG_TBLGEN} -gen-clang-decl-nodes \
173             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
174
175 StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td
176         ${CLANG_TBLGEN} -gen-clang-stmt-nodes \
177             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
178
179 arm_neon.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td
180         ${CLANG_TBLGEN} -gen-arm-neon \
181             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
182
183 arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td
184         ${CLANG_TBLGEN} -gen-arm-neon-sema \
185             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
186
187 DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
188         ${CLANG_TBLGEN} -gen-clang-diag-groups \
189             -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \
190             -o ${.TARGET} ${.ALLSRC}
191
192 DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
193         ${CLANG_TBLGEN} -gen-clang-diags-index-name \
194             -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \
195             -o ${.TARGET} ${.ALLSRC}
196
197 .for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization
198 Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
199         ${CLANG_TBLGEN} -gen-clang-diags-defs -clang-component=${hdr} \
200             -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \
201             -o ${.TARGET} ${.ALLSRC}
202 .endfor
203
204 Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td
205         ${TBLGEN} -gen-opt-parser-defs \
206             -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \
207             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
208
209 CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td
210         ${TBLGEN} -gen-opt-parser-defs \
211             -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \
212             -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} ${.ALLSRC}
213
214 Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \
215             ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td
216         ${CLANG_TBLGEN} -gen-clang-sa-checkers \
217             -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \
218             ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td
219
220 .for dep in ${TGHDRS:C/$/.inc.d/}
221 . sinclude "${dep}"
222 .endfor
223
224 SRCS+=          ${TGHDRS:C/$/.inc.h/}
225 DPADD+=         ${TGHDRS:C/$/.inc.h/}
226 CLEANFILES+=    ${TGHDRS:C/$/.inc.h/} ${TGHDRS:C/$/.inc.d/}