Home | History | Annotate | Line # | Download | only in llvm
Makefile revision 1.21
      1 #	$NetBSD: Makefile,v 1.21 2017/01/11 12:08:34 joerg 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 
     12 realdepends realall: config/config.status need-dl need-terminfo
     13 
     14 config/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 && ${HOST_SH} ${CONFIG_DIR}/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 
     23 need-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 
     33 need-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 
     42 CLEANFILES+=	need-dl need-dl.c need-dl.out need-terminfo need-terminfo.c need-terminfo.out
     43 
     44 cleandir: cleandir-llvm
     45 
     46 cleandir-llvm: .PHONY
     47 	test ! -d config || rm -r config
     48 	rm -f need-dl need-dl.tmp
     49 
     50 .include <bsd.hostprog.mk>
     51