1# $FreeBSD$ 2.if !target(_DIRDEP_USE) 3# we are the 1st makefile 4 5.if !defined(MK_CLANG) 6.include "${SRCTOP}/share/mk/src.opts.mk" 7.endif 8 9# DEP_MACHINE is set before we get here, this may not be. 10DEP_RELDIR ?= ${RELDIR} 11 12.if ${.TARGETS:Uall:M*/*} && empty(DIRDEPS) 13# This little trick let's us do 14# 15# mk -f dirdeps.mk some/dir.i386,bsd 16# 17DIRDEPS := ${.TARGETS:M*/*} 18${.TARGETS:Nall}: all 19.endif 20 21# making universe is special 22.if defined(UNIVERSE_GUARD) 23# these should be done by now 24DIRDEPS_FILTER+= N*.host 25.endif 26 27# pseudo machines get no qualification 28.for m in host common 29M_dep_qual_fixes += C;($m),[^/.,]*$$;\1; 30.endfor 31#.info M_dep_qual_fixes=${M_dep_qual_fixes} 32 33# Cheat for including src.libnames.mk 34__<bsd.init.mk>__: 35# Pull in _INTERNALLIBS 36.include <src.libnames.mk> 37 38# Host libraries should mostly be excluded from the build so the 39# host version in /usr/lib is used. Internal libraries need to be 40# allowed to be built though since they are never installed. 41_need_host_libs= 42.for lib in ${_INTERNALLIBS} 43_need_host_libs+= ${LIB${lib:tu}DIR:S,^${ROOTOBJDIR}/,,} 44.endfor 45 46N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToSkip}}:${M_ListToSkip}} 47DIRDEPS_FILTER.host = \ 48 ${N_host_libs} \ 49 Ninclude* \ 50 Nlib/csu* \ 51 Nlib/[mn]* \ 52 Ngnu/lib/csu* \ 53 Ngnu/lib/lib[a-r]* \ 54 Nusr.bin/xinstall* \ 55 56 57DIRDEPS_FILTER+= \ 58 Nbin/cat.host \ 59 ${DIRDEPS_FILTER.xtras:U} 60.endif 61 62# reset this each time 63DIRDEPS_FILTER.xtras= 64.if ${DEP_MACHINE:Npkgs*} != "" 65DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host 66.endif 67 68.if ${DEP_MACHINE} != "host" 69 70# this is how we can handle optional dependencies 71.if ${DEP_RELDIR} == "lib/libc" 72DIRDEPS += lib/libc_nonshared 73.if ${MK_SSP:Uno} != "no" 74DIRDEPS += gnu/lib/libssp/libssp_nonshared 75.endif 76.else 77DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared 78.endif 79 80# some optional things 81.if ${MK_CTF} == "yes" && ${DEP_RELDIR:Mcddl/usr.bin/ctf*} == "" 82DIRDEPS += \ 83 cddl/usr.bin/ctfconvert.host \ 84 cddl/usr.bin/ctfmerge.host 85.endif 86 87.endif 88 89.if ${MK_CLANG} == "yes" && ${DEP_RELDIR:Nlib/clang/lib*:Nlib/libc*} == "" 90DIRDEPS+= lib/clang/include 91.endif 92 93.if ${MK_STAGING} == "yes" 94# we need targets/pseudo/stage to prep the stage tree 95.if ${DEP_RELDIR} != "targets/pseudo/stage" 96DIRDEPS += targets/pseudo/stage 97.endif 98.endif 99 100DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}} 101CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH} 102CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}} 103BOOT_MACHINE_DIR:= ${BOOT_MACHINE_DIR.${DEP_MACHINE}} 104KERNEL_NAME:= ${KERNEL_NAME.${DEP_MACHINE}} 105