1*0a6a1f1dSLionel Sambuc# $NetBSD: bsd.klinks.mk,v 1.13 2014/08/10 05:57:31 matt Exp $ 2e1091647SArun Thomas# 3e1091647SArun Thomas 4e1091647SArun Thomas.include <bsd.own.mk> 5e1091647SArun Thomas 684d9c625SLionel SambucKLINK_MACHINE?= ${MACHINE} 784d9c625SLionel Sambuc 8e1091647SArun Thomas##### Default values 9e1091647SArun Thomas.if !defined(S) 10e1091647SArun Thomas.if defined(NETBSDSRCDIR) 11e1091647SArun ThomasS= ${NETBSDSRCDIR}/sys 12e1091647SArun Thomas.elif defined(BSDSRCDIR) 13e1091647SArun ThomasS= ${BSDSRCDIR}/sys 14e1091647SArun Thomas.else 15e1091647SArun ThomasS= /sys 16e1091647SArun Thomas.endif 17e1091647SArun Thomas.endif 18e1091647SArun Thomas 1984d9c625SLionel SambucCLEANFILES+= machine ${MACHINE_CPU} ${KLINK_MACHINE} 2084d9c625SLionel Sambuc.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" 21e1091647SArun ThomasCLEANFILES+= sun68k 2284d9c625SLionel Sambuc.elif ${KLINK_MACHINE} == "sparc64" 23e1091647SArun ThomasCLEANFILES+= sparc 2484d9c625SLionel Sambuc.elif ${KLINK_MACHINE} == "i386" 25e1091647SArun ThomasCLEANFILES+= x86 2684d9c625SLionel Sambuc.elif ${KLINK_MACHINE} == "amd64" 279152e1c5SLionel SambucCLEANFILES+= x86 i386 2884d9c625SLionel Sambuc.elif ${KLINK_MACHINE} == "evbmips" 299152e1c5SLionel SambucCLEANFILES+= algor sbmips 30*0a6a1f1dSLionel Sambuc.elif ${MACHINE_CPU} == "aarch64" 31*0a6a1f1dSLionel SambucCLEANFILES+= arm 32e1091647SArun Thomas.endif 33e1091647SArun Thomas 3484d9c625SLionel Sambuc.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" 35e1091647SArun ThomasCLEANFILES+= xen xen-ma/machine # xen-ma 36e1091647SArun ThomasCPPFLAGS+= -I${.OBJDIR}/xen-ma 37e1091647SArun Thomas.if ${MACHINE_CPU} == "i386" 38e1091647SArun ThomasCLEANFILES+= x86 39e1091647SArun Thomas.endif 40e1091647SArun Thomas.endif 41e1091647SArun Thomas 42e1091647SArun Thomas# XXX. This should be done a better way. It's @'d to reduce visual spew. 43e1091647SArun Thomas# XXX .BEGIN is used to make sure the links are done before anything else. 44e1091647SArun Thomas.if !make(obj) && !make(clean) && !make(cleandir) 45e1091647SArun Thomas.BEGIN: 46*0a6a1f1dSLionel Sambuc -@rm -f machine && \ 4784d9c625SLionel Sambuc ln -s $S/arch/${KLINK_MACHINE}/include machine 48*0a6a1f1dSLionel Sambuc -@rm -f ${KLINK_MACHINE} && \ 4984d9c625SLionel Sambuc ln -s $S/arch/${KLINK_MACHINE}/include ${KLINK_MACHINE} 50*0a6a1f1dSLionel Sambuc -@if [ -d $S/arch/${MACHINE_CPU} ]; then \ 519152e1c5SLionel Sambuc rm -f ${MACHINE_CPU} && \ 529152e1c5SLionel Sambuc ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \ 539152e1c5SLionel Sambuc fi 54e1091647SArun Thomas# XXX. it gets worse.. 5584d9c625SLionel Sambuc.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" 56*0a6a1f1dSLionel Sambuc -@rm -f sun68k && \ 57e1091647SArun Thomas ln -s $S/arch/sun68k/include sun68k 58e1091647SArun Thomas.endif 5984d9c625SLionel Sambuc.if ${KLINK_MACHINE} == "sparc64" 60*0a6a1f1dSLionel Sambuc -@rm -f sparc && \ 61e1091647SArun Thomas ln -s $S/arch/sparc/include sparc 62e1091647SArun Thomas.endif 6384d9c625SLionel Sambuc.if ${KLINK_MACHINE} == "amd64" 64*0a6a1f1dSLionel Sambuc -@rm -f i386 && \ 65e1091647SArun Thomas ln -s $S/arch/i386/include i386 66e1091647SArun Thomas.endif 6784d9c625SLionel Sambuc.if ${MACHINE_CPU} == "i386" || ${MACHINE_CPU} == "x86_64" 68*0a6a1f1dSLionel Sambuc -@rm -f x86 && \ 69e1091647SArun Thomas ln -s $S/arch/x86/include x86 70e1091647SArun Thomas.endif 71*0a6a1f1dSLionel Sambuc.if ${MACHINE_CPU} == "aarch64" 72*0a6a1f1dSLionel Sambuc -@rm -f arm && \ 73*0a6a1f1dSLionel Sambuc ln -s $S/arch/arm/include arm 74*0a6a1f1dSLionel Sambuc.endif 7584d9c625SLionel Sambuc.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" 76*0a6a1f1dSLionel Sambuc -@rm -f xen && \ 77e1091647SArun Thomas ln -s $S/arch/xen/include xen 78*0a6a1f1dSLionel Sambuc -@rm -rf xen-ma && mkdir xen-ma && \ 79e1091647SArun Thomas ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine 80e1091647SArun Thomas.endif 8184d9c625SLionel Sambuc.if ${KLINK_MACHINE} == "evbmips" 82*0a6a1f1dSLionel Sambuc -@rm -f algor && \ 839152e1c5SLionel Sambuc ln -s $S/arch/algor/include algor 84*0a6a1f1dSLionel Sambuc -@rm -f sbmips && \ 859152e1c5SLionel Sambuc ln -s $S/arch/sbmips/include sbmips 869152e1c5SLionel Sambuc.endif 87e1091647SArun Thomas.endif 88