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