# $NetBSD: Makefile.xen,v 1.48 2019/02/02 12:32:54 cherry Exp $
# NetBSD: Makefile.i386,v 1.132 2003/07/05 16:56:10 simonb Exp
# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/arch/xen/conf/``machineid''
# after which you should do
# config machineid
# Machine generic makefile changes should be made in
# /sys/arch/xen/conf/Makefile.xen
# after which config should be rerun for all machines of that type.
#
# To specify debugging, add the config line: makeoptions DEBUG="-g"
# A better way is to specify -g only for a few files.
#
# makeoptions DEBUGLIST="uvm* trap if_*"
.include "$S/arch/xen/conf/Makefile.arch.inc"
USETOOLS?= no
NEED_OWN_INSTALL_TARGET?=no
NORELRO=
NOSANITIZER=
.include <bsd.init.mk>
USE_SSP?= yes
##
## (1) port identification
##
XEN= $S/arch/xen
I386= $S/arch/i386
AMD64= $S/arch/amd64
GENASSYM_CONF= $S/arch/${XEN_BUILD}/${XEN_BUILD}/genassym.cf
ARCH_INC= $S/arch/xen/include/${XEN_BUILD}
##
## (2) compile settings
##
CPPFLAGS+= -D${XEN_BUILD}
AFLAGS+= -x assembler-with-cpp ${DBG} -D__XEN__
EXTRA_INCLUDES= -I${.CURDIR}/xen-ma -I$S/external/mit/xen-include-public/dist/
.if ${XEN_BUILD} == "amd64"
DEFCOPTS= -O2 -fno-omit-frame-pointer
CPPFLAGS+= -Dx86_64
CFLAGS+= -mcmodel=kernel
CFLAGS+= -mno-red-zone -mno-mmx -mno-sse -mno-avx
CFLAGS+= -msoft-float
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mno-fp-ret-in-387 :}
.endif
.if ${XEN_BUILD} == "i386"
DEFCOPTS= -O2 -fno-omit-frame-pointer
CFLAGS+= -msoft-float
CFLAGS+= -mno-mmx -mno-sse -mno-avx
.endif
##
## (3) libkern and compat
##
OPT_MODULAR= %MODULAR%
##
## (4) local objects, compile rules, and dependencies
##
MD_OBJS= locore.o spl.o copy.o vector.o
.if ${XEN_BUILD} == amd64
MD_OBJS+= amd64_trap.o
.endif
MD_CFILES=
MD_SFILES= $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S \
$S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S \
$S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S \
$S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S
.if ${XEN_BUILD} == amd64
MD_SFILES+= $S/arch/${XEN_BUILD}/${XEN_BUILD}/amd64_trap.S
.endif
copy.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S assym.h
${NORMAL_S}
locore.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S assym.h
${NORMAL_S}
spl.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S assym.h
${NORMAL_S}
vector.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S assym.h
${NORMAL_S}
.if ${XEN_BUILD} == amd64
amd64_trap.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/amd64_trap.S assym.h
${NORMAL_S}
.endif
.ifndef noBEGIN
.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN::
.for A in ${XEN_MACHINE_ARCHS}
-@rm -f ${A} && \
ln -s $S/arch/${A}/include ${A}
.endfor
-@rm -rf xen-ma && \
mkdir xen-ma && ln -s ../${XEN_BUILD} xen-ma/machine
-@rm -f machine && \
ln -s ${ARCH_INC} machine
.endif
.endif
##
## (5) link settings
##
.if ${XEN_BUILD} == i386
TEXTADDR?= 0xc0100000
.elif ${XEN_BUILD} == amd64
TEXTADDR?= 0xffffffff80200000
.endif
LINKFLAGS_NORMAL= -X
KERNLDSCRIPT?= $S/arch/${XEN_BUILD}/conf/kern.ldscript.Xen
##
## (6) port specific target dependencies
##
.if ${XEN_BUILD} == i386
linux_sigcode.o: assym.h
pnpbioscall.o bioscall.o: assym.h
mptramp.o: assym.h
.elif ${XEN_BUILD} == amd64
locore.o machdep.o: Makefile
linux32_sigcode.o netbsd32_sigcode.o: assym.h
.endif
busfunc.o cpu_in_cksum.o cpufunc.o lock_stubs.o: assym.h
##
## (7) misc settings
##
##
## (8) config(8) generated machinery
##
%INCLUDES
%OBJS
%CFILES
%SFILES
%LOAD
%RULES
##
## (9) port independent kernel machinery
##
.include "$S/conf/Makefile.kern.inc"
##
## (10) Appending make options.
##
%MAKEOPTIONSAPPEND