bsd.klinks.mk revision 1.4 1 # $NetBSD: bsd.klinks.mk,v 1.4 2009/03/15 05:48:02 tsutsui 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(obj) && !make(clean) && !make(cleandir)
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 @rm -f i386 && \
58 ln -s $S/arch/i386/include i386
59 .endif
60 .if ${MACHINE_CPU} == "i386"
61 @rm -f x86 && \
62 ln -s $S/arch/x86/include x86
63 .endif
64 .if defined(XEN_BUILD) || ${MACHINE} == "xen"
65 @rm -f xen && \
66 ln -s $S/arch/xen/include xen
67 @rm -rf xen-ma && mkdir xen-ma && \
68 ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine
69 .endif
70 .endif
71