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.if !defined(EARLY_BUILD) && defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no" 12CFLAGS+= -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 18CFLAGS+= -fno-strict-aliasing 19 20TARGET_ARCH?= ${MACHINE_ARCH} 21BUILD_ARCH?= ${MACHINE_ARCH} 22 23.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \ 24 ${MK_ARM_EABI} != "no" 25TARGET_ABI= gnueabi 26.else 27TARGET_ABI= unknown 28.endif 29 30TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0 31BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0 32CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \ 33 -DLLVM_HOSTTRIPLE=\"${BUILD_TRIPLE}\" \ 34 -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" 35CXXFLAGS+= -fno-exceptions -fno-rtti 36 37.PATH: ${LLVM_SRCS}/${SRCDIR} 38 39TBLGEN?= tblgen 40CLANG_TBLGEN?= clang-tblgen 41 42Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td \ 43 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsARM.td \ 44 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsHexagon.td \ 45 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsMips.td \ 46 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsNVVM.td \ 47 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsPowerPC.td \ 48 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsR600.td \ 49 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsX86.td \ 50 ${LLVM_SRCS}/include/llvm/IR/IntrinsicsXCore.td 51 ${TBLGEN} -I ${LLVM_SRCS}/include \ 52 -gen-intrinsic -o ${.TARGET} \ 53 ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td 54.for arch in \ 55 ARM/ARM Mips/Mips PowerPC/PPC 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} -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \ 72 ${hdr:T:C/,/ /g} -o ${.TARGET} \ 73 ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td 74. endfor 75.endfor 76 77Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 78 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 79 -gen-clang-attr-classes -o ${.TARGET} ${.ALLSRC} 80 81AttrDump.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 82 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 83 -gen-clang-attr-dump -o ${.TARGET} ${.ALLSRC} 84 85AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 86 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 87 -gen-clang-attr-impl -o ${.TARGET} ${.ALLSRC} 88AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 89 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 90 -gen-clang-attr-late-parsed-list -o ${.TARGET} ${.ALLSRC} 91 92AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 93 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 94 -gen-clang-attr-list -o ${.TARGET} ${.ALLSRC} 95 96AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 97 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 98 -gen-clang-attr-parsed-attr-kinds -o ${.TARGET} ${.ALLSRC} 99 100AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 101 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 102 -gen-clang-attr-parsed-attr-list -o ${.TARGET} ${.ALLSRC} 103 104AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 105 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 106 -gen-clang-attr-pch-read -o ${.TARGET} ${.ALLSRC} 107 108AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 109 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 110 -gen-clang-attr-pch-write -o ${.TARGET} ${.ALLSRC} 111 112AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 113 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 114 -gen-clang-attr-spelling-list -o ${.TARGET} ${.ALLSRC} 115 116AttrSpellingListIndex.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 117 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 118 -gen-clang-attr-spelling-index -o ${.TARGET} ${.ALLSRC} 119 120AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 121 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 122 -gen-clang-attr-template-instantiate -o ${.TARGET} ${.ALLSRC} 123 124CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 125 ${CLANG_TBLGEN} \ 126 -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC} 127 128CommentCommandList.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 129 ${CLANG_TBLGEN} \ 130 -gen-clang-comment-command-list -o ${.TARGET} ${.ALLSRC} 131 132CommentHTMLNamedCharacterReferences.inc.h: \ 133 ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td 134 ${CLANG_TBLGEN} \ 135 -gen-clang-comment-html-named-character-references -o ${.TARGET} \ 136 ${.ALLSRC} 137 138CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 139 ${CLANG_TBLGEN} \ 140 -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC} 141 142CommentHTMLTagsProperties.inc.h: \ 143 ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 144 ${CLANG_TBLGEN} \ 145 -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC} 146 147CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td 148 ${CLANG_TBLGEN} \ 149 -gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC} 150 151DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td 152 ${CLANG_TBLGEN} \ 153 -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC} 154 155StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td 156 ${CLANG_TBLGEN} \ 157 -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC} 158 159arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 160 ${CLANG_TBLGEN} \ 161 -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC} 162 163DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 164 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ 165 -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC} 166 167DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 168 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ 169 -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC} 170 171.for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization 172Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 173 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ 174 -gen-clang-diags-defs -clang-component=${hdr} -o ${.TARGET} \ 175 ${.ALLSRC} 176.endfor 177 178Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td 179 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver \ 180 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 181 182CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td 183 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver \ 184 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 185 186Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \ 187 ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td 188 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 189 -gen-clang-sa-checkers -o ${.TARGET} \ 190 ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td 191 192SRCS+= ${TGHDRS:C/$/.inc.h/} 193DPADD+= ${TGHDRS:C/$/.inc.h/} 194CLEANFILES+= ${TGHDRS:C/$/.inc.h/} 195