Home | History | Annotate | Line # | Download | only in mk
bsd.klinks.mk revision 1.7
      1 #	$NetBSD: bsd.klinks.mk,v 1.7 2010/03/13 22:05:49 christos 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}
     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
     26 .endif
     27 
     28 .if defined(XEN_BUILD) || ${MACHINE} == "xen"
     29 CLEANFILES+=	xen xen-ma/machine # xen-ma
     30 CPPFLAGS+=	-I${.OBJDIR}/xen-ma
     31 .if ${MACHINE_CPU} == "i386"
     32 CLEANFILES+=	x86
     33 .endif
     34 .endif
     35 
     36 # XXX.  This should be done a better way.  It's @'d to reduce visual spew.
     37 # XXX   .BEGIN is used to make sure the links are done before anything else.
     38 .if !make(obj) && !make(clean) && !make(cleandir)
     39 .BEGIN:
     40 	@rm -f machine && \
     41 	    ln -s $S/arch/${MACHINE}/include machine
     42 	@if [ -d $S/arch/${MACHINE_CPU} ]; then \
     43 	    rm -f ${MACHINE_CPU} && \
     44 	    ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \
     45 	 fi
     46 # XXX. it gets worse..
     47 .if ${MACHINE} == "sun2" || ${MACHINE} == "sun3"
     48 	@rm -f sun68k && \
     49 	    ln -s $S/arch/sun68k/include sun68k
     50 .endif
     51 .if ${MACHINE} == "sparc64"
     52 	@rm -f sparc && \
     53 	    ln -s $S/arch/sparc/include sparc
     54 .endif
     55 .if ${MACHINE} == "amd64"
     56 	@rm -f x86 && \
     57 	    ln -s $S/arch/x86/include x86
     58 	@rm -f i386 && \
     59 	    ln -s $S/arch/i386/include i386
     60 .endif
     61 .if ${MACHINE_CPU} == "i386"
     62 	@rm -f x86 && \
     63 	    ln -s $S/arch/x86/include x86
     64 .endif
     65 .if defined(XEN_BUILD) || ${MACHINE} == "xen"
     66 	@rm -f xen && \
     67 	    ln -s $S/arch/xen/include xen
     68 	@rm -rf xen-ma && mkdir xen-ma && \
     69 	    ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine
     70 .endif
     71 .endif
     72