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