3 CLANG_SRCS= ${LLVM_SRCS}/tools/clang
5 CFLAGS+= -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
11 .if !defined(EARLY_BUILD) && defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no"
12 CFLAGS+= -DCLANG_ENABLE_ARCMT \
13 -DCLANG_ENABLE_REWRITER \
14 -DCLANG_ENABLE_STATIC_ANALYZER
15 .endif # !EARLY_BUILD && MK_CLANG_FULL
17 # LLVM is not strict aliasing safe as of 12/31/2011
18 CFLAGS+= -fno-strict-aliasing
20 TARGET_ARCH?= ${MACHINE_ARCH}
21 BUILD_ARCH?= ${MACHINE_ARCH}
22 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
23 BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
24 CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \
25 -DLLVM_HOSTTRIPLE=\"${BUILD_TRIPLE}\" \
26 -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
27 CXXFLAGS+= -fno-exceptions -fno-rtti
29 .PATH: ${LLVM_SRCS}/${SRCDIR}
32 CLANG_TBLGEN?= clang-tblgen
33 TBLINC+= -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target
35 Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/Intrinsics.td
36 ${TBLGEN} -I ${LLVM_SRCS}/lib/VMCore ${TBLINC} -gen-intrinsic \
37 -o ${.TARGET} ${LLVM_SRCS}/include/llvm/Intrinsics.td
39 ARM/ARM Mips/Mips PowerPC/PPC X86/X86
41 AsmMatcher/-gen-asm-matcher \
42 AsmWriter1/-gen-asm-writer,-asmwriternum=1 \
43 AsmWriter/-gen-asm-writer \
44 CallingConv/-gen-callingconv \
45 CodeEmitter/-gen-emitter \
46 DAGISel/-gen-dag-isel \
47 DisassemblerTables/-gen-disassembler \
48 EDInfo/-gen-enhanced-disassembly-info \
49 FastISel/-gen-fast-isel \
50 InstrInfo/-gen-instr-info \
51 MCCodeEmitter/-gen-emitter,-mc-emitter \
52 MCPseudoLowering/-gen-pseudo-lowering \
53 RegisterInfo/-gen-register-info \
54 SubtargetInfo/-gen-subtarget
55 ${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
56 ${TBLGEN} -I ${LLVM_SRCS}/lib/Target/${arch:H} ${TBLINC} \
57 ${hdr:T:C/,/ /g} -o ${.TARGET} \
58 ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
62 Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
63 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
64 -gen-clang-attr-classes -o ${.TARGET} \
65 -I ${CLANG_SRCS}/include ${.ALLSRC}
67 AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
68 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
69 -gen-clang-attr-impl -o ${.TARGET} \
70 -I ${CLANG_SRCS}/include ${.ALLSRC}
72 AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
73 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
74 -gen-clang-attr-late-parsed-list -o ${.TARGET} \
75 -I ${CLANG_SRCS}/include ${.ALLSRC}
77 AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
78 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
79 -gen-clang-attr-list -o ${.TARGET} \
80 -I ${CLANG_SRCS}/include ${.ALLSRC}
82 AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
83 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
84 -gen-clang-attr-parsed-attr-kinds -o ${.TARGET} \
85 -I ${CLANG_SRCS}/include ${.ALLSRC}
87 AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
88 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
89 -gen-clang-attr-parsed-attr-list -o ${.TARGET} \
90 -I ${CLANG_SRCS}/include ${.ALLSRC}
92 AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
93 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Serialization \
94 ${TBLINC} -gen-clang-attr-pch-read -o ${.TARGET} \
95 -I ${CLANG_SRCS}/include ${.ALLSRC}
97 AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
98 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Serialization \
99 ${TBLINC} -gen-clang-attr-pch-write -o ${.TARGET} \
100 -I ${CLANG_SRCS}/include ${.ALLSRC}
102 AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
103 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Lex ${TBLINC} \
104 -gen-clang-attr-spelling-list -o ${.TARGET} \
105 -I ${CLANG_SRCS}/include ${.ALLSRC}
107 AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
108 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
109 -gen-clang-attr-template-instantiate -o ${.TARGET} \
110 -I ${CLANG_SRCS}/include ${.ALLSRC}
112 CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td
113 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
114 -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC}
116 CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
117 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
118 -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC}
120 CommentHTMLTagsProperties.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
121 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
122 -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC}
124 CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td
125 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
126 -gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC}
128 DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td
129 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
130 -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC}
132 StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td
133 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
134 -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC}
136 arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td
137 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
138 -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC}
140 DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
141 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
142 -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC}
144 DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
145 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
146 -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC}
148 .for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization
149 Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
150 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic ${TBLINC} \
151 -gen-clang-diags-defs -clang-component=${hdr} \
152 -o ${.TARGET} ${.ALLSRC}
155 Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td
156 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \
157 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC}
159 CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td
160 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Driver ${TBLINC} \
161 -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC}
163 Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \
164 ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td
165 ${CLANG_TBLGEN} -I ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers \
166 ${TBLINC} -gen-clang-sa-checkers -o ${.TARGET} \
167 -I ${CLANG_SRCS}/include \
168 ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td
170 SRCS+= ${TGHDRS:C/$/.inc.h/}
171 DPADD+= ${TGHDRS:C/$/.inc.h/}
172 CLEANFILES+= ${TGHDRS:C/$/.inc.h/}