Makefile revision 1.11
11.11Sjoerg#	$NetBSD: Makefile,v 1.11 2011/07/18 19:11:28 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.1Sjoergrealdepends realall: config/config.status need-dl \
131.1Sjoerg	config/include/clang/Basic/Version.inc
141.1Sjoerg
151.1Sjoergconfig/include/clang/Basic/Version.inc: \
161.1Sjoerg	${LLVM_TOPLEVEL}/config/clang/Basic/Version.inc
171.1Sjoerg	mkdir -p ${.TARGET:H}
181.1Sjoerg	cat < ${.ALLSRC} > ${.TARGET}
191.1Sjoerg
201.1Sjoergconfig/config.status: ${LLVM_SRCDIR}/configure
211.1Sjoerg	mkdir -p config
221.10Sadam	cd config && ${LLVM_SRCDIR}/configure CC=${HOST_CC:Q} --prefix=/usr \
231.10Sadam	    --enable-targets=x86,powerpc,sparc,arm,mips \
241.10Sadam	    --host=${MACHINE_GNU_PLATFORM} \
251.4Sjoerg	    --with-c-include-dirs=/usr/include/clang-3.0:/usr/include \
261.11Sjoerg	    --enable-optimized
271.11Sjoerg# --disable-assertions
281.4Sjoerg
291.1Sjoergneed-dl:
301.1Sjoerg	printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c
311.1Sjoerg	if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \
321.1Sjoerg		echo > ${.TARGET}; \
331.1Sjoerg	elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \
341.1Sjoerg		echo -ldl > ${.TARGET}; \
351.1Sjoerg	else \
361.1Sjoerg		echo > ${.TARGET}; \
371.1Sjoerg	fi
381.1Sjoerg
391.1SjoergCLEANFILES+=	need-dl need-dl.c need-dl.out
401.1Sjoerg
411.1Sjoergcleandir: cleandir-llvm
421.1Sjoerg
431.1Sjoergcleandir-llvm:
441.9Smatt	test ! -d config || rm -r config
451.1Sjoerg	rm -f need-dl need-dl.tmp
461.1Sjoerg
471.1Sjoerg.include <bsd.hostprog.mk>
48