1# $NetBSD: Makefile,v 1.24 2021/05/30 01:57:00 joerg Exp $ 2 3.include <bsd.hostinit.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 12realdepends realall: config/config.status need-dl need-terminfo support-modules 13 14dependall: clean-modulecache 15 16clean-modulecache: 17 rm -rf ${LLVM_MODULE_CACHE} 18 19config/config.status: ${LLVM_SRCDIR}/configure 20 mkdir -p config 21 printf '#!/bin/sh\necho 2.7.3' > config/python 22 chmod 755 config/python 23 cd config && ${HOST_SH} ${CONFIG_DIR}/configure ${LLVM_CONFIGURE_ARGS} \ 24 --enable-optimized CC=${HOST_CC:Q} CXX=${HOST_CXX:Q} \ 25 --with-python=${.OBJDIR}/config/python && \ 26 cp ${LLVM_TOPLEVEL}/include/module.modulemap include/llvm/module.modulemap 27 28support-modules: module-test.cpp Makefile 29 if ${HOST_CXX} -stdlib=libc++ -c -fmodules -fcxx-modules -fmodules-cache-path=./module.cache \ 30 ${.CURDIR}/module-test.cpp 3> /dev/null 2>&1; then \ 31 echo HOST_SUPPORTS_MODULES=yes > ${.TARGET}; \ 32 else \ 33 echo HOST_SUPPORTS_MODULES=no > ${.TARGET}; \ 34 fi 35 36need-dl: Makefile 37 printf '#include <dlfcn.h>\nint main(void){void *p; return dladdr(p, p);}' > need-dl.c 38 if ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c > /dev/null 2>&1; then \ 39 echo > ${.TARGET}; \ 40 elif ${HOST_CC} -o need-dl.out -D_GNU_SOURCE need-dl.c -ldl > /dev/null 2>&1; then \ 41 echo -ldl > ${.TARGET}; \ 42 else \ 43 echo > ${.TARGET}; \ 44 fi 45 46need-terminfo: Makefile 47 printf 'int setupterm(char *, int, int *);\nint main(void){return setupterm("", 0, 0);}' > need-terminfo.c 48 for lib in tinfo terminfo ncurses curses; do \ 49 if ${HOST_CC} -o need-terminfo.out need-terminfo.c -l$$lib > /dev/null 2>&1; then \ 50 echo -l$$lib > ${.TARGET}; \ 51 break; \ 52 fi; \ 53 done 54 55CLEANFILES+= need-dl need-dl.c need-dl.out need-terminfo need-terminfo.c need-terminfo.out 56 57cleandir: cleandir-llvm 58 59cleandir-llvm: .PHONY 60 test ! -d config || rm -r config 61 test ! -d module-cache || rm -r module-cache 62 rm -f need-dl need-dl.tmp module-cache module-test.o 63 64.include <bsd.hostprog.mk> 65