Makefile revision 1.17
11.17Sjoerg#	$NetBSD: Makefile,v 1.17 2013/09/02 14:34:57 joerg Exp $
21.1Sjoerg
31.1Sjoerg.include <bsd.init.mk>
41.1Sjoerg
51.1Sjoerg#
61.1Sjoerg# Do *not* set HOSTPROG or HOSTLIB at this point otherwise
71.1Sjoerg# it will create a loop trying to extract the object directory.
81.1Sjoerg#
91.1Sjoerg.include "Makefile.inc"
101.1Sjoerg.include "${LLVM_TOPLEVEL}/lib/Makefile.inc"
111.1Sjoerg
121.17Sjoergrealdepends realall: config/config.status need-dl need-terminfo
131.1Sjoerg
141.1Sjoergconfig/config.status: ${LLVM_SRCDIR}/configure
151.1Sjoerg	mkdir -p config
161.16Sjoerg	printf '#!/bin/sh\necho 2.7.3' > config/python
171.16Sjoerg	chmod 755 config/python
181.15Sjoerg	cd config && ${LLVM_SRCDIR}/configure ${LLVM_CONFIGURE_ARGS} \
191.16Sjoerg	    --enable-optimized CC=${HOST_CC:Q} \
201.16Sjoerg	    --with-python=${.OBJDIR}/config/python
211.11Sjoerg# --disable-assertions
221.4Sjoerg
231.1Sjoergneed-dl:
241.1Sjoerg	printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c
251.1Sjoerg	if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \
261.1Sjoerg		echo > ${.TARGET}; \
271.1Sjoerg	elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \
281.1Sjoerg		echo -ldl > ${.TARGET}; \
291.1Sjoerg	else \
301.1Sjoerg		echo > ${.TARGET}; \
311.1Sjoerg	fi
321.1Sjoerg
331.17Sjoergneed-terminfo:
341.17Sjoerg	printf '#include <term.h>\nint main(void){return setupterm(0, 0, 0);}' > need-terminfo.c
351.17Sjoerg	for lib in tinfo terminfo ncurses curses; do \
361.17Sjoerg		if ${HOST_CC} -o need-terminfo.out need-terminfo.c -l$$lib > /dev/null 2>&1; then \
371.17Sjoerg			echo -l$$lib > ${.TARGET}; \
381.17Sjoerg			break; \
391.17Sjoerg		fi; \
401.17Sjoerg	done
411.17Sjoerg
421.17SjoergCLEANFILES+=	need-dl need-dl.c need-dl.out need-terminfo need-terminfo.c need-terminfo.out
431.1Sjoerg
441.1Sjoergcleandir: cleandir-llvm
451.1Sjoerg
461.1Sjoergcleandir-llvm:
471.9Smatt	test ! -d config || rm -r config
481.1Sjoerg	rm -f need-dl need-dl.tmp
491.1Sjoerg
501.1Sjoerg.include <bsd.hostprog.mk>
51