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# Correct for gcc miscompilation when compiling on PPC with -O2 12.if ${MACHINE_CPUARCH} == "powerpc" 13CFLAGS+= -O1 14.endif 15 16TARGET_ARCH?= ${MACHINE_ARCH} 17CFLAGS+=-DLLVM_HOSTTRIPLE=\"${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0\" 18 19.ifndef LLVM_REQUIRES_EH 20CXXFLAGS+=-fno-exceptions 21.else 22# If the library or program requires EH, it also requires RTTI. 23LLVM_REQUIRES_RTTI= 24.endif 25 26.ifndef LLVM_REQUIRES_RTTI 27CXXFLAGS+=-fno-rtti 28.endif 29 30.ifdef TOOLS_PREFIX 31CFLAGS+=-DCLANG_PREFIX=\"${TOOLS_PREFIX}\" 32.endif 33 34.PATH: ${LLVM_SRCS}/${SRCDIR} 35 36TBLGEN?=tblgen 37CLANG_TBLGEN?=clang-tblgen 38TBLINC+=-I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target 39 40Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/Intrinsics.td 41 ${TBLGEN} -I ${LLVM_SRCS}/lib/VMCore ${TBLINC} -gen-intrinsic \ 42 -o ${.TARGET} ${LLVM_SRCS}/include/llvm/Intrinsics.td 43.for arch in \ 44 ARM/ARM Mips/Mips PowerPC/PPC X86/X86 45. for hdr in \ 46 AsmMatcher/-gen-asm-matcher \ 47 AsmWriter1/-gen-asm-writer,-asmwriternum=1 \ 48 AsmWriter/-gen-asm-writer \ 49 CallingConv/-gen-callingconv \ 50 CodeEmitter/-gen-emitter \ 51 DAGISel/-gen-dag-isel \ 52 DisassemblerTables/-gen-disassembler \ 53 EDInfo/-gen-enhanced-disassembly-info \ 54 FastISel/-gen-fast-isel \ 55 InstrInfo/-gen-instr-info \ 56 MCCodeEmitter/-gen-emitter,-mc-emitter \ 57 MCPseudoLowering/-gen-pseudo-lowering \ 58 RegisterInfo/-gen-register-info \ 59 SubtargetInfo/-gen-subtarget 60${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td 61 ${TBLGEN} -I ${LLVM_SRCS}/lib/Target/${arch:H} ${TBLINC} \ 62 ${hdr:T:C/,/ /g} -o ${.TARGET} \ 63 ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td 64. endfor 65.endfor 66 67Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 68 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \ 69 -gen-clang-attr-classes -o ${.TARGET} \ 70 -I ${CLANG_SRCS}/include ${.ALLSRC} 71 72AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 73 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \ 74 -gen-clang-attr-impl -o ${.TARGET} \ 75 -I ${CLANG_SRCS}/include ${.ALLSRC} 76 77AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 78 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \ 79 -gen-clang-attr-late-parsed-list -o ${.TARGET} \ 80 -I ${CLANG_SRCS}/include ${.ALLSRC} 81 82AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 83 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \ 84 -gen-clang-attr-list -o ${.TARGET} \ 85 -I ${CLANG_SRCS}/include ${.ALLSRC} 86 87AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 88 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Serialization \ 89 ${TBLINC} -gen-clang-attr-pch-read -o ${.TARGET} \ 90 -I ${CLANG_SRCS}/include ${.ALLSRC} 91 92AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 93 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Serialization \ 94 ${TBLINC} -gen-clang-attr-pch-write -o ${.TARGET} \ 95 -I ${CLANG_SRCS}/include ${.ALLSRC} 96 97AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td 98 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Lex ${TBLINC} \ 99 -gen-clang-attr-spelling-list -o ${.TARGET} \ 100 -I ${CLANG_SRCS}/include ${.ALLSRC} 101 102DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td 103 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \ 104 -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC} 105 106StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td 107 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \ 108 -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC} 109 110arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td 111 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \ 112 -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC} 113 114DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 115 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \ 116 -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC} 117 118DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 119 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \ 120 -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC} 121 122.for hdr in AST Analysis Common Driver Frontend Lex Parse Sema 123Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td 124 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \ 125 -gen-clang-diags-defs -clang-component=${hdr} \ 126 -o ${.TARGET} ${.ALLSRC} 127.endfor 128 129Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td 130 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \ 131 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 132 133CC1Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1Options.td 134 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \ 135 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 136 137CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td 138 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \ 139 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} 140 141Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \ 142 ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td 143 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers \ 144 ${TBLINC} -gen-clang-sa-checkers -o ${.TARGET} \ 145 -I ${CLANG_SRCS}/include \ 146 ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td 147 148SRCS+= ${TGHDRS:C/$/.inc.h/} 149DPADD+= ${TGHDRS:C/$/.inc.h/} 150CLEANFILES+= ${TGHDRS:C/$/.inc.h/} 151