Makefile revision 1.15
1#	$NetBSD: Makefile,v 1.15 2012/06/17 07:40:25 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	cd config && ${LLVM_SRCDIR}/configure ${LLVM_CONFIGURE_ARGS} \
17	    --enable-optimized CC=${HOST_CC:Q}
18# --disable-assertions
19
20need-dl:
21	printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c
22	if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \
23		echo > ${.TARGET}; \
24	elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \
25		echo -ldl > ${.TARGET}; \
26	else \
27		echo > ${.TARGET}; \
28	fi
29
30CLEANFILES+=	need-dl need-dl.c need-dl.out
31
32cleandir: cleandir-llvm
33
34cleandir-llvm:
35	test ! -d config || rm -r config
36	rm -f need-dl need-dl.tmp
37
38.include <bsd.hostprog.mk>
39