Makefile.amd64 revision 1.69
1#	$NetBSD: Makefile.amd64,v 1.69 2018/04/18 09:29:35 martin Exp $
2
3# Makefile for NetBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arch/amd64/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/amd64/conf/Makefile.amd64
13# after which config should be rerun for all machines of that type.
14#
15# To specify debugging, add the config line: makeoptions DEBUG="-g"
16# A better way is to specify -g only for a few files.
17#
18#	makeoptions DEBUGLIST="uvm* trap if_*"
19
20MACHINE_ARCH=x86_64
21USETOOLS?=	no
22NEED_OWN_INSTALL_TARGET?=no
23.include <bsd.own.mk>
24
25USE_SSP?=	yes
26
27##
28## (1) port identification
29##
30AMD64=		$S/arch/amd64
31GENASSYM_CONF=	${AMD64}/amd64/genassym.cf
32
33##
34## (2) compile settings
35##
36DEFCOPTS=	-O2 -fno-omit-frame-pointer
37CPPFLAGS+=	-Damd64 -Dx86_64
38CFLAGS+=	-mcmodel=kernel
39# -mno-sse implies -mno-sse2 (etc), explicitly disable avx to be extra sure
40CFLAGS+=	-mno-red-zone -mno-mmx -mno-sse -mno-avx
41# make absolutely sure we don't get x87 registers used as well
42CFLAGS+=	-msoft-float
43# For gcc we might need this, but other compilers barf
44# CFLAGS+=	-mno-fp-ret-in-387
45
46.if !empty(SPECTRE_V2_GCC_MITIGATION) && ${SPECTRE_V2_GCC_MITIGATION:U0} > 0 \
47	&& ${HAVE_GCC:U0} > 0
48CFLAGS+=      -mindirect-branch=thunk-inline
49CFLAGS+=      -mindirect-branch-register
50.endif
51
52##
53## (3) libkern and compat
54##
55OPT_MODULAR=	%MODULAR%
56.if !empty(OPT_MODULAR)
57KERN_AS=	obj
58.else
59KERN_AS=	library
60.endif
61
62##
63## (4) local objects, compile rules, and dependencies
64##
65
66##
67## (5) link settings
68##
69TEXTADDR?=	0xffffffff80200000
70.if defined(KASLR)
71EXTRA_LINKFLAGS=	--split-by-file=0x100000 -r -d
72KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
73.else
74EXTRA_LINKFLAGS=	-z max-page-size=0x200000
75KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript
76.endif
77LINKFLAGS_NORMAL=	-X
78
79##
80## (6) port specific target dependencies
81##
82
83# depend on CPU configuration
84locore.o machdep.o: Makefile
85
86acpi_wakeup_low.o amd64func.o busfunc.o cpufunc.o cpu_in_cksum.o: assym.h
87linux_sigcode.o linux32_sigcode.o lock_stubs.o mptramp.o: assym.h
88netbsd32_sigcode.o: assym.h
89
90##
91## (7) misc settings
92##
93
94##
95## (8) config(8) generated machinery
96##
97%INCLUDES
98
99%OBJS
100
101%CFILES
102
103%SFILES
104
105%LOAD
106
107%RULES
108
109##
110## (9) port independent kernel machinery
111##
112.include "$S/conf/Makefile.kern.inc"
113
114## Include rules for ACPI wakecode
115.include "$S/arch/x86/acpi/Makefile.wakecode.inc"
116
117##
118## (10) Appending make options.
119##
120%MAKEOPTIONSAPPEND
121