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