unstack, sort: cleanup and improvement
[minix.git] / share / mk / bsd.klinks.mk
blobb35c2de65e7545ead2daaf0e9fe9fb503deeb659
1 # $NetBSD: bsd.klinks.mk,v 1.6 2009/11/27 13:50:29 pooka Exp $
4 .include <bsd.own.mk>
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
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
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
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 @rm -f ${MACHINE_CPU} && \
43 ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}
44 # XXX. it gets worse..
45 .if ${MACHINE} == "sun2" || ${MACHINE} == "sun3"
46 @rm -f sun68k && \
47 ln -s $S/arch/sun68k/include sun68k
48 .endif
49 .if ${MACHINE} == "sparc64"
50 @rm -f sparc && \
51 ln -s $S/arch/sparc/include sparc
52 .endif
53 .if ${MACHINE} == "amd64"
54 @rm -f x86 && \
55 ln -s $S/arch/x86/include x86
56 @rm -f i386 && \
57 ln -s $S/arch/i386/include i386
58 .endif
59 .if ${MACHINE_CPU} == "i386"
60 @rm -f x86 && \
61 ln -s $S/arch/x86/include x86
62 .endif
63 .if defined(XEN_BUILD) || ${MACHINE} == "xen"
64 @rm -f xen && \
65 ln -s $S/arch/xen/include xen
66 @rm -rf xen-ma && mkdir xen-ma && \
67 ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine
68 .endif
69 .endif