1#	$NetBSD: Makefile.xen,v 1.50 2020/05/02 16:44:36 bouyer Exp $
2#	NetBSD: Makefile.i386,v 1.132 2003/07/05 16:56:10 simonb Exp 
3
4# Makefile for NetBSD
5#
6# This makefile is constructed from a machine description:
7#	config machineid
8# Most changes should be made in the machine description
9#	/sys/arch/xen/conf/``machineid''
10# after which you should do
11#	config machineid
12# Machine generic makefile changes should be made in
13#	/sys/arch/xen/conf/Makefile.xen
14# after which config should be rerun for all machines of that type.
15#
16# To specify debugging, add the config line: makeoptions DEBUG="-g"
17# A better way is to specify -g only for a few files.
18#
19#	makeoptions DEBUGLIST="uvm* trap if_*"
20
21.include "$S/arch/xen/conf/Makefile.arch.inc"
22USETOOLS?=	no
23NEED_OWN_INSTALL_TARGET?=no
24NORELRO=
25NOSANITIZER=
26.include <bsd.init.mk>
27
28USE_SSP?=	yes
29
30##
31## (1) port identification
32##
33XEN=		$S/arch/xen
34I386=		$S/arch/i386
35AMD64=          $S/arch/amd64
36GENASSYM_CONF=	$S/arch/${XEN_BUILD}/${XEN_BUILD}/genassym.cf
37
38ARCH_INC=	$S/arch/xen/include/${XEN_BUILD}
39
40##
41## (2) compile settings
42##
43CPPFLAGS+=	-D${XEN_BUILD}
44AFLAGS+=	-x assembler-with-cpp ${DBG}
45EXTRA_INCLUDES=	-I${.CURDIR}/xen-ma -I$S/external/mit/xen-include-public/dist/
46
47.if ${XEN_BUILD} == "amd64"
48DEFCOPTS=	-O2 -fno-omit-frame-pointer
49CPPFLAGS+=	-Dx86_64
50CFLAGS+=	-mcmodel=kernel
51CFLAGS+=	-mno-red-zone -mno-mmx -mno-sse -mno-avx
52CFLAGS+=	-msoft-float
53CFLAGS+=	${${ACTIVE_CC} == "gcc":?  -mno-fp-ret-in-387 :}
54.endif
55
56.if ${XEN_BUILD} == "i386"
57DEFCOPTS=	-O2 -fno-omit-frame-pointer
58CFLAGS+=	-msoft-float
59CFLAGS+=	-mno-mmx -mno-sse -mno-avx
60.endif
61
62##
63## (3) libkern and compat
64##
65OPT_MODULAR=	%MODULAR%
66
67##
68## (4) local objects, compile rules, and dependencies
69##
70
71MD_OBJS=
72.if ${XEN_BUILD} == i386
73MD_OBJS+=	locore.o spl.o copy.o vector.o lock_stubs.o
74.endif
75MD_CFILES=
76
77MD_SFILES=
78.if ${XEN_BUILD} == i386
79MD_SFILES+=	$S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S \
80		$S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S \
81		$S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S \
82		$S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S \
83		$S/arch/${XEN_BUILD}/${XEN_BUILD}/lock_stubs.S
84
85.endif
86
87.if ${XEN_BUILD} == i386
88copy.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S assym.h
89	${NORMAL_S}
90
91locore.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S assym.h
92	${NORMAL_S}
93
94spl.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S assym.h
95	${NORMAL_S}
96
97vector.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S assym.h
98	${NORMAL_S}
99
100lock_stubs.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/lock_stubs.S assym.h
101	${NORMAL_S}
102.endif
103
104.ifndef noBEGIN
105.if !make(obj) && !make(clean) && !make(cleandir)
106.BEGIN::
107.for A in ${XEN_MACHINE_ARCHS}
108	-@rm -f ${A} && \
109	    ln -s $S/arch/${A}/include ${A}
110.endfor
111	-@rm -rf xen-ma && \
112	    mkdir xen-ma && ln -s ../${XEN_BUILD} xen-ma/machine
113	-@rm -f machine && \
114	    ln -s ${ARCH_INC} machine
115.endif
116.endif
117
118##
119## (5) link settings
120##
121.if ${XEN_BUILD} == i386
122TEXTADDR?=	0xc0100000
123.elif ${XEN_BUILD} == amd64
124TEXTADDR?=	0xffffffff80200000
125.endif
126LINKFLAGS_NORMAL=	-X
127KERNLDSCRIPT?=	$S/arch/${XEN_BUILD}/conf/kern.ldscript.Xen
128
129##
130## (6) port specific target dependencies
131##
132
133.if ${XEN_BUILD} == i386
134linux_sigcode.o: assym.h
135pnpbioscall.o bioscall.o: assym.h
136mptramp.o: assym.h
137.elif  ${XEN_BUILD} == amd64
138locore.o machdep.o: Makefile
139linux32_sigcode.o netbsd32_sigcode.o: assym.h
140.endif
141busfunc.o cpu_in_cksum.o cpufunc.o lock_stubs.o: assym.h
142
143##
144## (7) misc settings
145##
146
147##
148## (8) config(8) generated machinery
149##
150%INCLUDES
151
152%OBJS
153
154%CFILES
155
156%SFILES
157
158%LOAD
159
160%RULES
161
162##
163## (9) port independent kernel machinery
164##
165.include "$S/conf/Makefile.kern.inc"
166
167##
168## (10) Appending make options.
169##
170%MAKEOPTIONSAPPEND
171