Makefile revision 1.16
1#	$NetBSD: Makefile,v 1.16 2013/02/20 14:13:31 joerg Exp $
2
3.include <bsd.init.mk>
4
5#
6# Do *not* set HOSTPROG or HOSTLIB at this point otherwise
7# it will create a loop trying to extract the object directory.
8#
9.include "Makefile.inc"
10.include "${LLVM_TOPLEVEL}/lib/Makefile.inc"
11
12realdepends realall: config/config.status need-dl
13
14config/config.status: ${LLVM_SRCDIR}/configure
15	mkdir -p config
16	printf '#!/bin/sh\necho 2.7.3' > config/python
17	chmod 755 config/python
18	cd config && ${LLVM_SRCDIR}/configure ${LLVM_CONFIGURE_ARGS} \
19	    --enable-optimized CC=${HOST_CC:Q} \
20	    --with-python=${.OBJDIR}/config/python
21# --disable-assertions
22
23need-dl:
24	printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c
25	if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \
26		echo > ${.TARGET}; \
27	elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \
28		echo -ldl > ${.TARGET}; \
29	else \
30		echo > ${.TARGET}; \
31	fi
32
33CLEANFILES+=	need-dl need-dl.c need-dl.out
34
35cleandir: cleandir-llvm
36
37cleandir-llvm:
38	test ! -d config || rm -r config
39	rm -f need-dl need-dl.tmp
40
41.include <bsd.hostprog.mk>
42