# This library should compile to the same thing on all variants of
# ${MACHINE} with the same ${MACHINE_ARCH} so shared /usr works.
# If it is necessary to run different code based on ${MACHINE} then
# the dispatch on ${MACHINE} should be done at run time (see m68k).
include <bsd.own.mk>
if exists(kvm_${KVM_MACHINE_ARCH}.c)
SRCS+= kvm_${KVM_MACHINE_ARCH}.c
elif exists(kvm_${KVM_MACHINE_CPU}.c)
SRCS+= kvm_${KVM_MACHINE_CPU}.c
elif exists(kvm_${MACHINE_ARCH}.c)
SRCS+= kvm_${MACHINE_ARCH}.c
elif exists(kvm_${MACHINE_CPU}.c)
SRCS+= kvm_${MACHINE_CPU}.c
else
BEGIN:
@echo no kvm_xx.c for ${MACHINE_ARCH} nor ${MACHINE_CPU}
@false
endif
if ${MACHINE_ARCH} == "i386"
LINTFLAGS+=-w
LINTFLAGS+= -X 351 # 'extern' declaration outside header
LINTFLAGS+= -X 352 # 'extern' declaration in function body
SRCS+= kvm_i386pae.c # Hook PAE support in the i386 build
endif
# Additional modules needed for m68k
if (${MACHINE_ARCH} == "m68k" || ${MACHINE_CPU} == "m68k")
SRCS+= kvm_m68k_cmn.c kvm_sun2.c kvm_sun3.c kvm_sun3x.c
endif
# This fixes building with MACHINE==sparc64, MACHINE_ARCH==sparc
# XXX: this is a hack, but until the sparc MD headers are separated
# out from the sparc AD headers, it's the easiest solution.
#
if (${MACHINE_ARCH} == "sparc") # {
if !make(obj) && !make(clean) && !make(cleandir)
BEGIN:
@([ -h machine ] || \
ln -fs ${NETBSDSRCDIR}/sys/arch/sparc/include machine)
@([ -h sparc ] || ln -fs ${NETBSDSRCDIR}/sys/arch/sparc/include sparc)
NOPATH: machine sparc
endif
CLEANFILES+= machine sparc
CPPFLAGS+= -I.
endif # }
if (${MACHINE_ARCH} == "mips")
CPPFLAGS+= -D_KMEMUSER
endif