minix/share/mk/bsd.klinks.mk
Lionel Sambuc 9152e1c5a7 Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
 * tools
 * distribution
 * sets
 * release

The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.

For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.

Regarding new or modifications of Makefiles a few things:
 * Read share/mk/bsd.README
 * If you add a subdirectory, add a Makefile in it, and have it called
   by the parent through the SUBDIR variable.
 * Do not add arbitrary inclusion which crosses to another branch of
   the hierarchy; If you can't do without it, put a comment on why.
   If possible, do not use inclusion at all.
 * Use as much as possible the infrastructure, it is here to make
   life easier, do not fight it.

Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-11-15 16:07:29 +01:00

82 lines
2 KiB
Makefile

# $NetBSD: bsd.klinks.mk,v 1.9 2011/07/10 23:50:24 matt Exp $
#
.include <bsd.own.mk>
##### Default values
.if !defined(S)
.if defined(NETBSDSRCDIR)
S= ${NETBSDSRCDIR}/sys
.elif defined(BSDSRCDIR)
S= ${BSDSRCDIR}/sys
.else
S= /sys
.endif
.endif
CLEANFILES+= machine ${MACHINE_CPU} ${MACHINE}
.if ${MACHINE} == "sun2" || ${MACHINE} == "sun3"
CLEANFILES+= sun68k
.elif ${MACHINE} == "sparc64"
CLEANFILES+= sparc
.elif ${MACHINE} == "i386"
CLEANFILES+= x86
.elif ${MACHINE} == "amd64"
CLEANFILES+= x86 i386
.elif ${MACHINE} == "evbmips"
CLEANFILES+= algor sbmips
.endif
.if defined(XEN_BUILD) || ${MACHINE} == "xen"
CLEANFILES+= xen xen-ma/machine # xen-ma
CPPFLAGS+= -I${.OBJDIR}/xen-ma
.if ${MACHINE_CPU} == "i386"
CLEANFILES+= x86
.endif
.endif
# XXX. This should be done a better way. It's @'d to reduce visual spew.
# XXX .BEGIN is used to make sure the links are done before anything else.
.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN:
@rm -f machine && \
ln -s $S/arch/${MACHINE}/include machine
@rm -f ${MACHINE} && \
ln -s $S/arch/${MACHINE}/include ${MACHINE}
@if [ -d $S/arch/${MACHINE_CPU} ]; then \
rm -f ${MACHINE_CPU} && \
ln -s $S/arch/${MACHINE_CPU}/include ${MACHINE_CPU}; \
fi
# XXX. it gets worse..
.if ${MACHINE} == "sun2" || ${MACHINE} == "sun3"
@rm -f sun68k && \
ln -s $S/arch/sun68k/include sun68k
.endif
.if ${MACHINE} == "sparc64"
@rm -f sparc && \
ln -s $S/arch/sparc/include sparc
.endif
.if ${MACHINE} == "amd64"
@rm -f x86 && \
ln -s $S/arch/x86/include x86
@rm -f i386 && \
ln -s $S/arch/i386/include i386
.endif
.if ${MACHINE_CPU} == "i386"
@rm -f x86 && \
ln -s $S/arch/x86/include x86
.endif
.if defined(XEN_BUILD) || ${MACHINE} == "xen"
@rm -f xen && \
ln -s $S/arch/xen/include xen
@rm -rf xen-ma && mkdir xen-ma && \
ln -s ../${XEN_BUILD:U${MACHINE_ARCH}} xen-ma/machine
.endif
.if ${MACHINE} == "evbmips"
@rm -f algor && \
ln -s $S/arch/algor/include algor
@rm -f sbmips && \
ln -s $S/arch/sbmips/include sbmips
.endif
.endif