Makefile revision 1.18
1#	$NetBSD: Makefile,v 1.18 2014/01/16 09:00:55 matt 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 need-terminfo
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} CXX=${HOST_CXX: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
33need-terminfo:
34	printf '#include <term.h>\nint main(void){return setupterm(0, 0, 0);}' > need-terminfo.c
35	for lib in tinfo terminfo ncurses curses; do \
36		if ${HOST_CC} -o need-terminfo.out need-terminfo.c -l$$lib > /dev/null 2>&1; then \
37			echo -l$$lib > ${.TARGET}; \
38			break; \
39		fi; \
40	done
41
42CLEANFILES+=	need-dl need-dl.c need-dl.out need-terminfo need-terminfo.c need-terminfo.out
43
44cleandir: cleandir-llvm
45
46cleandir-llvm:
47	test ! -d config || rm -r config
48	rm -f need-dl need-dl.tmp
49
50.include <bsd.hostprog.mk>
51