Makefile revision 1.4
11.4Sjoerg#	$NetBSD: Makefile,v 1.4 2011/05/16 19:27:47 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.1Sjoerg	cd config && ${LLVM_SRCDIR}/configure --prefix=/usr \
231.2Sjoerg	    --enable-targets=x86 --host=x86_64--netbsd \
241.4Sjoerg	    --with-c-include-dirs=/usr/include/clang-3.0:/usr/include \
251.2Sjoerg	    --enable-optimized --disable--assertions
261.4Sjoerg
271.1Sjoergneed-dl:
281.1Sjoerg	printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c
291.1Sjoerg	if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \
301.1Sjoerg		echo > ${.TARGET}; \
311.1Sjoerg	elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \
321.1Sjoerg		echo -ldl > ${.TARGET}; \
331.1Sjoerg	else \
341.1Sjoerg		echo > ${.TARGET}; \
351.1Sjoerg	fi
361.1Sjoerg
371.1SjoergCLEANFILES+=	need-dl need-dl.c need-dl.out
381.1Sjoerg
391.1Sjoergcleandir: cleandir-llvm
401.1Sjoerg
411.1Sjoergcleandir-llvm:
421.1Sjoerg	rm -r config
431.1Sjoerg	rm -f need-dl need-dl.tmp
441.1Sjoerg
451.1Sjoerg.include <bsd.hostprog.mk>
46