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