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