summaryrefslogtreecommitdiff
path: root/lib/libGL/gallium/Makefile.inc
blob: 067a63fc4b3ab47bed28ffcc568a2256965be9ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# $OpenBSD: Makefile.inc,v 1.5 2014/01/11 12:39:14 miod Exp $
.include <bsd.xconf.mk>

CPP=	cpp -notraditional

CFLAGS+= -std=c99
CPPFLAGS+= -DPACKAGE_BUGREPORT=\"bugs@openbsd.org\"

OBJS+=  ${SRCS:N*.h:R:S/$/.so/g}

.SUFFIXES:
.SUFFIXES: .a .c .cpp .o .so

.c.so:
	@echo "${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}"
	@${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o
	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

.cpp.so:
	@echo "${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}"
	@${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o
	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

lib${LIB}_pic.a: ${OBJS} ${DPADD}
	@rm -f lib${LIB}_pic.a
	@${AR} cq lib${LIB}_pic.a `${LORDER} ${OBJS} | tsort -q`
	${RANLIB} lib${LIB}_pic.a


.if ${XENOCARA_BUILD_GALLIUM} == "llvm"

# Remember to keep in sync with LLVM port's version.
LLVM_VERSION=	0x303	# 3.3 
LLVM_CONFIG?=	/usr/local/bin/llvm-config

# ugh...
ALLVM_CFLAGS!=		${LLVM_CONFIG} --cflags
ALLVM_CPPFLAGS!=	${LLVM_CONFIG} --cxxflags
BLLVM_CFLAGS=	${ALLVM_CFLAGS:M-[IDf]*}
BLLVM_CPPFLAGS=	${ALLVM_CPPFLAGS:M-[IDf]*}
LLVM_CFLAGS=	${BLLVM_CFLAGS:S/-DNDEBUG//}
LLVM_CPPFLAGS=	${BLLVM_CPPFLAGS:S/-DNDEBUG//}
LLVM_LIBDIR!=	${LLVM_CONFIG} --libdir
LLVM_LIBS!=	${LLVM_CONFIG} --libs engine bitwriter mcjit r600 bitreader ipo asmparser

CFLAGS+=	${LLVM_CFLAGS}
CXXFLAGS=	${LLVM_CPPFLAGS}
LDADD+=		-L${LLVM_LIBDIR} ${LLVM_LIBS}

CPPFLAGS+= \
	-DGALLIUM_LLVMPIPE \
	-DHAVE_LLVM=${LLVM_VERSION}

SWRAST_DRIVERS+= ../../gallium/drivers/llvmpipe/libllvmpipe_pic.a

# for r600 and radeonsi
LOCALBASE?=	/usr/local
LDADD+=		${LOCALBASE}/lib/libelf.a
.endif

.if ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "powerpc" || \
    ${MACHINE_ARCH} == "sparc"
PICFLAG=-fPIC
.endif