Makefile revision 1.2
11.2Sjoerg#	$NetBSD: Makefile,v 1.2 2011/03/18 23:32:04 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.2Sjoerg	    --with-clang-resource-dir=${DESTDIR}/usr/lib \
251.2Sjoerg	    --enable-optimized --disable--assertions
261.1Sjoergneed-dl:
271.1Sjoerg	printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c
281.1Sjoerg	if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \
291.1Sjoerg		echo > ${.TARGET}; \
301.1Sjoerg	elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \
311.1Sjoerg		echo -ldl > ${.TARGET}; \
321.1Sjoerg	else \
331.1Sjoerg		echo > ${.TARGET}; \
341.1Sjoerg	fi
351.1Sjoerg
361.1SjoergCLEANFILES+=	need-dl need-dl.c need-dl.out
371.1Sjoerg
381.1Sjoergcleandir: cleandir-llvm
391.1Sjoerg
401.1Sjoergcleandir-llvm:
411.1Sjoerg	rm -r config
421.1Sjoerg	rm -f need-dl need-dl.tmp
431.1Sjoerg
441.1Sjoerg.include <bsd.hostprog.mk>
45