xref: /freebsd/lib/clang/clang.build.mk (revision 7aa383846770374466b1dcb2cefd71bde9acf463)
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}-undermydesk-freebsd9.0\" \
19	-DCLANG_VENDOR=\"FreeBSD\ \" -DSVN_REVISION=\"104832\" \
20	-DCLANG_VENDOR_SUFFIX=\"\ 20100615\"
21
22.PATH:	${LLVM_SRCS}/${SRCDIR}
23
24TBLGEN=tblgen ${CFLAGS:M-I*}
25
26Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/Intrinsics.td
27	${TBLGEN} -gen-intrinsic \
28		${LLVM_SRCS}/include/llvm/Intrinsics.td > ${.TARGET}
29.for arch in \
30	ARM/ARM Mips/Mips PowerPC/PPC X86/X86
31. for hdr in \
32	AsmMatcher/-gen-asm-matcher \
33	AsmWriter1/-gen-asm-writer,-asmwriternum=1 \
34	AsmWriter/-gen-asm-writer \
35	CallingConv/-gen-callingconv \
36	CodeEmitter/-gen-emitter \
37	DAGISel/-gen-dag-isel \
38	FastISel/-gen-fast-isel \
39	InstrInfo/-gen-instr-desc \
40	InstrNames/-gen-instr-enums \
41	RegisterInfo.h/-gen-register-desc-header \
42	RegisterInfo/-gen-register-desc \
43	RegisterNames/-gen-register-enums \
44	Subtarget/-gen-subtarget
45${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
46	${TBLGEN} ${hdr:T:C/,/ /g} \
47		${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td > ${.TARGET}
48. endfor
49.endfor
50
51DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
52	${TBLGEN} -I${CLANG_SRCS}/include/clang/Basic \
53		-gen-clang-diag-groups \
54		${CLANG_SRCS}/include/clang/Basic/Diagnostic.td > ${.TARGET}
55.for hdr in AST Analysis Common Driver Frontend Lex Parse Sema
56Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td
57	${TBLGEN} -I${CLANG_SRCS}/include/clang/Basic \
58		-gen-clang-diags-defs -clang-component=${hdr} \
59		${CLANG_SRCS}/include/clang/Basic/Diagnostic.td > ${.TARGET}
60.endfor
61CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td
62	${TBLGEN} -I${CLANG_SRCS}/include/clang/Driver \
63	   -gen-opt-parser-defs \
64	   ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td > ${.TARGET}
65CC1Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1Options.td
66	${TBLGEN} -I${CLANG_SRCS}/include/clang/Driver \
67	   -gen-opt-parser-defs \
68	   ${CLANG_SRCS}/include/clang/Driver/CC1Options.td > ${.TARGET}
69Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td
70	${TBLGEN} -I${CLANG_SRCS}/include/clang/Driver \
71	   -gen-opt-parser-defs \
72	   ${CLANG_SRCS}/include/clang/Driver/Options.td > ${.TARGET}
73StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/AST/StmtNodes.td
74	${TBLGEN} -I${CLANG_SRCS}/include/clang/AST \
75		-gen-clang-stmt-nodes \
76		${CLANG_SRCS}/include/clang/AST/StmtNodes.td > ${.TARGET}
77
78SRCS+=		${TGHDRS:C/$/.inc.h/}
79DPADD+=		${TGHDRS:C/$/.inc.h/}
80CLEANFILES+=	${TGHDRS:C/$/.inc.h/}
81