Makefile.amd64 revision 1.72
1# $NetBSD: Makefile.amd64,v 1.72 2018/08/20 15:04:51 maxv 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 23NOSANITIZER= 24.include <bsd.init.mk> 25 26USE_SSP?= yes 27 28## 29## (1) port identification 30## 31AMD64= $S/arch/amd64 32GENASSYM_CONF= ${AMD64}/amd64/genassym.cf 33 34## 35## (2) compile settings 36## 37DEFCOPTS= -O2 -fno-omit-frame-pointer 38CPPFLAGS+= -Damd64 -Dx86_64 39CFLAGS+= -mcmodel=kernel 40# -mno-sse implies -mno-sse2 (etc), explicitly disable avx to be extra sure 41CFLAGS+= -mno-red-zone -mno-mmx -mno-sse -mno-avx 42# make absolutely sure we don't get x87 registers used as well 43CFLAGS+= -msoft-float 44# For gcc we might need this, but other compilers barf 45# CFLAGS+= -mno-fp-ret-in-387 46 47.if ${SPECTRE_V2_GCC_MITIGATION:U0} > 0 && ${HAVE_GCC:U0} > 0 48CFLAGS+= -mindirect-branch=thunk-inline 49CFLAGS+= -mindirect-branch-register 50.endif 51 52.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 53CFLAGS+= -fsanitize=kernel-address --param asan-globals=1 54COPTS.asan.c+= -fno-sanitize=kernel-address 55.endif 56 57## 58## (3) libkern and compat 59## 60OPT_MODULAR= %MODULAR% 61.if !empty(OPT_MODULAR) 62KERN_AS= obj 63.else 64KERN_AS= library 65.endif 66 67## 68## (4) local objects, compile rules, and dependencies 69## 70 71## 72## (5) link settings 73## 74TEXTADDR?= 0xffffffff80200000 75.if defined(KASLR) 76EXTRA_LINKFLAGS= --split-by-file=0x100000 -r -d 77KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr 78.else 79EXTRA_LINKFLAGS= -z max-page-size=0x200000 80KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript 81.endif 82LINKFLAGS_NORMAL= -X 83 84## 85## (6) port specific target dependencies 86## 87 88# depend on CPU configuration 89locore.o machdep.o: Makefile 90 91acpi_wakeup_low.o amd64func.o busfunc.o cpufunc.o cpu_in_cksum.o: assym.h 92linux_sigcode.o linux32_sigcode.o lock_stubs.o mptramp.o: assym.h 93netbsd32_sigcode.o: assym.h 94 95## 96## (7) misc settings 97## 98 99## 100## (8) config(8) generated machinery 101## 102%INCLUDES 103 104%OBJS 105 106%CFILES 107 108%SFILES 109 110%LOAD 111 112%RULES 113 114## 115## (9) port independent kernel machinery 116## 117.include "$S/conf/Makefile.kern.inc" 118 119## Include rules for ACPI wakecode 120.include "$S/arch/x86/acpi/Makefile.wakecode.inc" 121 122## 123## (10) Appending make options. 124## 125%MAKEOPTIONSAPPEND 126