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 42.if empty(TOOLSDIR) || !exists(${TOOLSDIR}/usr/bin/clang-tblgen) 43.if ${MACHINE} == "host" && defined(BOOTSTRAPPING_TOOLS) 44.if !empty(LEGACY_TOOLS) && exists(${LEGACY_TOOLS}/usr/bin/tblgen) 45TOOLSDIR= ${LEGACY_TOOLS} 46.endif 47.endif 48.if ${MK_STAGING} == "yes" && exists(${STAGE_HOST_OBJTOP:Uno}/usr/bin/tblgen) 49TOOLSDIR= ${STAGE_HOST_OBJTOP} 50.endif 51.if exists(${LEGACY_TOOLS:Uno}/usr/bin/tblgen) 52TOOLSDIR= ${LEGACY_TOOLS} 53.endif 54.endif 55TOOLSDIR?= 56.if !empty(TOOLSDIR) && exists(${TOOLSDIR}/usr/bin/clang-tblgen) 57TBLGEN= ${TOOLSDIR}/usr/bin/tblgen 58CLANG_TBLGEN= ${TOOLSDIR}/usr/bin/clang-tblgen 59.endif 60TBLGEN?= tblgen 61CLANG_TBLGEN?= clang-tblgen 62 63Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td 64 ${TBLGEN} -gen-intrinsic \ 65 -I ${LLVM_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 66 ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td 67.for arch in \ 68 AArch64/AArch64 ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86 69. for hdr in \ 70 AsmMatcher/-gen-asm-matcher \ 71 AsmWriter1/-gen-asm-writer,-asmwriternum=1 \ 72 AsmWriter/-gen-asm-writer \ 73 CallingConv/-gen-callingconv \ 74 CodeEmitter/-gen-emitter \ 75 DAGISel/-gen-dag-isel \ 76 DisassemblerTables/-gen-disassembler \ 77 FastISel/-gen-fast-isel \ 78 InstrInfo/-gen-instr-info \ 79 MCCodeEmitter/-gen-emitter \ 80 MCPseudoLowering/-gen-pseudo-lowering \ 81 RegisterInfo/-gen-register-info \ 82 SubtargetInfo/-gen-subtarget 83${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td 84 ${TBLGEN} ${hdr:T:C/,/ /g} \ 85 -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \ 86 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 87 ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td 88. endfor 89.endfor 90 91Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 92 ${CLANG_TBLGEN} -gen-clang-attr-classes \ 93 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 94 ${CLANG_SRCS}/include/clang/Basic/Attr.td 95 96AttrDump.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 97 ${CLANG_TBLGEN} -gen-clang-attr-dump \ 98 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 99 ${CLANG_SRCS}/include/clang/Basic/Attr.td 100 101AttrHasAttributeImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 102 ${CLANG_TBLGEN} -gen-clang-attr-has-attribute-impl \ 103 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 104 ${CLANG_SRCS}/include/clang/Basic/Attr.td 105 106AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 107 ${CLANG_TBLGEN} -gen-clang-attr-impl \ 108 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 109 ${CLANG_SRCS}/include/clang/Basic/Attr.td 110 111AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 112 ${CLANG_TBLGEN} -gen-clang-attr-list \ 113 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 114 ${CLANG_SRCS}/include/clang/Basic/Attr.td 115 116AttrParsedAttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 117 ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-impl \ 118 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 119 ${CLANG_SRCS}/include/clang/Basic/Attr.td 120 121AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 122 ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-kinds \ 123 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 124 ${CLANG_SRCS}/include/clang/Basic/Attr.td 125 126AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 127 ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-list \ 128 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 129 ${CLANG_SRCS}/include/clang/Basic/Attr.td 130 131AttrParserStringSwitches.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 132 ${CLANG_TBLGEN} -gen-clang-attr-parser-string-switches \ 133 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 134 ${CLANG_SRCS}/include/clang/Basic/Attr.td 135 136AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 137 ${CLANG_TBLGEN} -gen-clang-attr-pch-read \ 138 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 139 ${CLANG_SRCS}/include/clang/Basic/Attr.td 140 141AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 142 ${CLANG_TBLGEN} -gen-clang-attr-pch-write \ 143 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 144 ${CLANG_SRCS}/include/clang/Basic/Attr.td 145 146AttrSpellingListIndex.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 147 ${CLANG_TBLGEN} -gen-clang-attr-spelling-index \ 148 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 149 ${CLANG_SRCS}/include/clang/Basic/Attr.td 150 151AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 152 ${CLANG_TBLGEN} -gen-clang-attr-template-instantiate \ 153 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 154 ${CLANG_SRCS}/include/clang/Basic/Attr.td 155 156AttrVisitor.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 157 ${CLANG_TBLGEN} -gen-clang-attr-ast-visitor \ 158 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 159 ${CLANG_SRCS}/include/clang/Basic/Attr.td 160 161CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 162 ${CLANG_TBLGEN} -gen-clang-comment-command-info \ 163 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 164 ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 165 166CommentCommandList.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 167 ${CLANG_TBLGEN} -gen-clang-comment-command-list \ 168 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 169 ${CLANG_SRCS}/include/clang/AST/CommentCommands.td 170 171CommentHTMLNamedCharacterReferences.inc.h: \ 172 ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td 173 ${CLANG_TBLGEN} -gen-clang-comment-html-named-character-references \ 174 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 175 ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td 176 177CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 178 ${CLANG_TBLGEN} -gen-clang-comment-html-tags \ 179 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 180 ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 181 182CommentHTMLTagsProperties.inc.h: \ 183 ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 184 ${CLANG_TBLGEN} -gen-clang-comment-html-tags-properties \ 185 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 186 ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td 187 188CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td 189 ${CLANG_TBLGEN} -gen-clang-comment-nodes \ 190 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 191 ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td 192 193DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td 194 ${CLANG_TBLGEN} -gen-clang-decl-nodes \ 195 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 196 ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td 197 198StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td 199 ${CLANG_TBLGEN} -gen-clang-stmt-nodes \ 200 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 201 ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td 202 203arm_neon.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 204 ${CLANG_TBLGEN} -gen-arm-neon \ 205 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 206 ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 207 208arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 209 ${CLANG_TBLGEN} -gen-arm-neon-sema \ 210 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 211 ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 212 213DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 214 ${CLANG_TBLGEN} -gen-clang-diag-groups \ 215 -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ 216 -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 217 218DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 219 ${CLANG_TBLGEN} -gen-clang-diags-index-name \ 220 -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ 221 -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 222 223.for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization 224Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 225 ${CLANG_TBLGEN} -gen-clang-diags-defs -clang-component=${hdr} \ 226 -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ 227 -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 228.endfor 229 230Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td 231 ${TBLGEN} -gen-opt-parser-defs \ 232 -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ 233 -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 234 ${CLANG_SRCS}/include/clang/Driver/Options.td 235 236Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td 237 ${CLANG_TBLGEN} -gen-clang-sa-checkers \ 238 -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ 239 ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td 240 241.for dep in ${TGHDRS:C/$/.inc.d/} 242. sinclude "${dep}" 243.endfor 244 245SRCS+= ${TGHDRS:C/$/.inc.h/} 246DPSRCS+= ${TGHDRS:C/$/.inc.h/} 247CLEANFILES+= ${TGHDRS:C/$/.inc.h/} ${TGHDRS:C/$/.inc.d/} 248 249# if we are not doing explicit 'make depend', there is 250# nothing to cause these to be generated. 251beforebuild: ${SRCS:M*.inc.h} 252