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