1# $NetBSD: bsd.klinks.mk,v 1.12 2014/01/22 15:19:05 christos Exp $ 2# 3 4.include <bsd.own.mk> 5 6KLINK_MACHINE?= ${MACHINE} 7 8##### Default values 9.if !defined(S) 10.if defined(NETBSDSRCDIR) 11S= ${NETBSDSRCDIR}/sys 12.elif defined(BSDSRCDIR) 13S= ${BSDSRCDIR}/sys 14.else 15S= /sys 16.endif 17.endif 18 19CLEANFILES+= machine ${MACHINE_CPU} ${KLINK_MACHINE} 20.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" 21CLEANFILES+= sun68k 22.elif ${KLINK_MACHINE} == "sparc64" 23CLEANFILES+= sparc 24.elif ${KLINK_MACHINE} == "i386" 25CLEANFILES+= x86 26.elif ${KLINK_MACHINE} == "amd64" 27CLEANFILES+= x86 i386 28.elif ${KLINK_MACHINE} == "evbmips" 29CLEANFILES+= algor sbmips 30.endif 31 32.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" 33CLEANFILES+= xen xen-ma/machine # xen-ma 34CPPFLAGS+= -I${.OBJDIR}/xen-ma 35.if ${MACHINE_CPU} == "i386" 36CLEANFILES+= x86 37.endif 38.endif 39 40# XXX. This should be done a better way. It's @'d to reduce visual spew. 41# XXX .BEGIN is used to make sure the links are done before anything else. 42.if !make(obj) && !make(clean) && !make(cleandir) 43.BEGIN: 44 -@rm -f machine && \ 45 ln -s $S/arch/${KLINK_MACHINE}/include machine 46 -@rm -f ${KLINK_MACHINE} && \ 47 ln -s $S/arch/${KLINK_MACHINE}/include ${KLINK_MACHINE} 48 -@if [ -d $S/arch/${MACHINE_CPU} ]; then \ 49 rm -f ${MACHINE_CPU} && \ 50 ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \ 51 fi 52# XXX. it gets worse.. 53.if ${KLINK_MACHINE} == "sun2" || ${KLINK_MACHINE} == "sun3" 54 -@rm -f sun68k && \ 55 ln -s $S/arch/sun68k/include sun68k 56.endif 57.if ${KLINK_MACHINE} == "sparc64" 58 -@rm -f sparc && \ 59 ln -s $S/arch/sparc/include sparc 60.endif 61.if ${KLINK_MACHINE} == "amd64" 62 -@rm -f i386 && \ 63 ln -s $S/arch/i386/include i386 64.endif 65.if ${MACHINE_CPU} == "i386" || ${MACHINE_CPU} == "x86_64" 66 -@rm -f x86 && \ 67 ln -s $S/arch/x86/include x86 68.endif 69.if defined(XEN_BUILD) || ${KLINK_MACHINE} == "xen" 70 -@rm -f xen && \ 71 ln -s $S/arch/xen/include xen 72 -@rm -rf xen-ma && mkdir xen-ma && \ 73 ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine 74.endif 75.if ${KLINK_MACHINE} == "evbmips" 76 -@rm -f algor && \ 77 ln -s $S/arch/algor/include algor 78 -@rm -f sbmips && \ 79 ln -s $S/arch/sbmips/include sbmips 80.endif 81.endif 82