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