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}-freebsd11.0 31BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd11.0 32CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \ 33 -DLLVM_HOST_TRIPLE=\"${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 85AttrExprArgs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 86 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 87 -gen-clang-attr-expr-args-list -o ${.TARGET} ${.ALLSRC} 88 89AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 90 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 91 -gen-clang-attr-impl -o ${.TARGET} ${.ALLSRC} 92AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 93 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 94 -gen-clang-attr-late-parsed-list -o ${.TARGET} ${.ALLSRC} 95 96AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 97 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 98 -gen-clang-attr-list -o ${.TARGET} ${.ALLSRC} 99 100AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 101 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 102 -gen-clang-attr-parsed-attr-kinds -o ${.TARGET} ${.ALLSRC} 103 104AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 105 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 106 -gen-clang-attr-parsed-attr-list -o ${.TARGET} ${.ALLSRC} 107 108AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 109 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 110 -gen-clang-attr-pch-read -o ${.TARGET} ${.ALLSRC} 111 112AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 113 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 114 -gen-clang-attr-pch-write -o ${.TARGET} ${.ALLSRC} 115 116AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 117 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 118 -gen-clang-attr-spelling-list -o ${.TARGET} ${.ALLSRC} 119 120AttrSpellingListIndex.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 121 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 122 -gen-clang-attr-spelling-index -o ${.TARGET} ${.ALLSRC} 123 124AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 125 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 126 -gen-clang-attr-template-instantiate -o ${.TARGET} ${.ALLSRC} 127 128CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 129 ${CLANG_TBLGEN} \ 130 -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC} 131 132CommentCommandList.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 133 ${CLANG_TBLGEN} \ 134 -gen-clang-comment-command-list -o ${.TARGET} ${.ALLSRC} 135 136CommentHTMLNamedCharacterReferences.inc.h: \ 137 ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td 138 ${CLANG_TBLGEN} \ 139 -gen-clang-comment-html-named-character-references -o ${.TARGET} \ 140 ${.ALLSRC} 141 142CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 143 ${CLANG_TBLGEN} \ 144 -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC} 145 146CommentHTMLTagsProperties.inc.h: \ 147 ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 148 ${CLANG_TBLGEN} \ 149 -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC} 150 151CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td 152 ${CLANG_TBLGEN} \ 153 -gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC} 154 155DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td 156 ${CLANG_TBLGEN} \ 157 -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC} 158 159StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td 160 ${CLANG_TBLGEN} \ 161 -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC} 162 163arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 164 ${CLANG_TBLGEN} \ 165 -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC} 166 167DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 168 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ 169 -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC} 170 171DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 172 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ 173 -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC} 174 175.for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization 176Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 177 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ 178 -gen-clang-diags-defs -clang-component=${hdr} -o ${.TARGET} \ 179 ${.ALLSRC} 180.endfor 181 182Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td 183 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver \ 184 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 185 186CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td 187 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver \ 188 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 189 190Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \ 191 ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td 192 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ 193 -gen-clang-sa-checkers -o ${.TARGET} \ 194 ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td 195 196SRCS+= ${TGHDRS:C/$/.inc.h/} 197DPADD+= ${TGHDRS:C/$/.inc.h/} 198CLEANFILES+= ${TGHDRS:C/$/.inc.h/} 199