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