1 # $NetBSD: Makefile.aarch64,v 1.14 2018/11/08 08:28:07 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/<arch>/conf/``machineid'' 9 # after which you should do 10 # config machineid 11 # Machine generic makefile changes should be made in 12 # /sys/arch/arm/conf/Makefile.arm 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 20 USETOOLS?= no 21 NEED_OWN_INSTALL_TARGET?=no 22 .include <bsd.own.mk> 23 24 ## 25 ## (1) port identification 26 ## 27 THISARM= $S/arch/${MACHINE} 28 ARM= $S/arch/aarch64 29 GENASSYM_CONF= ${ARM}/aarch64/genassym.cf 30 .-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" 31 32 ## 33 ## (2) compile settings 34 ## 35 # CPPFLAGS set by platform-specific Makefile fragment. 36 CFLAGS+= -march=armv8-a+nofp+nosimd 37 #CFLAGS+= -fomit-frame-pointer 38 CFLAGS+= -fno-omit-frame-pointer 39 CFLAGS+= -mno-omit-leaf-frame-pointer 40 #CFLAGS+= -mno-unaligned-access 41 42 .if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 43 KASANFLAGS= -fsanitize=kernel-address \ 44 --param asan-globals=1 --param asan-stack=1 \ 45 -fasan-shadow-offset=0xDFFF208000000000 46 .for f in subr_asan.c 47 KASANFLAGS.${f}= # empty 48 .endfor 49 CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}} 50 .endif 51 52 ## 53 ## (3) libkern and compat 54 ## 55 OPT_MODULAR= %MODULAR% 56 57 ## 58 ## (4) local objects, compile rules, and dependencies 59 ## 60 MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 61 MD_CFILES+= 62 MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/aarch64/locore.S 63 64 .if defined(SYSTEM_FIRST_OBJ) 65 ${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 66 ${NORMAL_S} 67 .endif 68 69 locore.o: ${ARM}/aarch64/locore.S assym.h 70 ${NORMAL_S} 71 72 ## 73 ## (5) link settings 74 ## 75 KERNLDSCRIPT?= ${ARM}/conf/kern.ldscript 76 LOADADDRESS?= 0xffffffc000000040 77 LINKFLAGS_NORMAL= -X 78 79 # Strip AArch64 mapping symbols from the kernel image, as they interfere 80 # with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified. 81 .if !defined(DEBUG) || empty(DEBUG:M-g*) 82 SYSTEM_LD_TAIL?= ${OBJCOPY} -w --strip-symbol='[$$][dx]' \ 83 --strip-symbol='[$$][dx]\.*' $@ ;\ 84 ${SIZE} $@; chmod 755 $@ 85 .else 86 STRIPFLAGS=-g --strip-symbol='$$x' --strip-symbol='$$d' 87 .endif 88 89 ## 90 ## (6) port specific target dependencies 91 ## 92 93 # depend on DIAGNOSTIC etc. 94 cpuswitch.o fault.o machdep.o: Makefile 95 96 # various assembly files that depend on assym.h 97 atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 98 exception.o sigcode.o: assym.h 99 spl.o vectors.o: assym.h 100 101 ## 102 ## (7) misc settings 103 ## 104 105 # define .MAIN _before_ the make() check, so that implicit target 106 # would be defined 107 .MAIN: all 108 109 .if !make(obj) && !make(clean) && !make(cleandir) 110 .BEGIN:: 111 -@rm -f arm && \ 112 ln -s $S/arch/arm/include arm 113 .endif 114 115 ## 116 ## (8) config(8) generated machinery 117 ## 118 %INCLUDES 119 120 %OBJS 121 122 %CFILES 123 124 %SFILES 125 126 %LOAD 127 128 %RULES 129 130 ## 131 ## (9) after the config file is inserted 132 ## 133 134 ## 135 ## (10) port independent kernel machinery 136 ## 137 138 .include "$S/conf/Makefile.kern.inc" 139 140 ## 141 ## (11) Appending make options. 142 ## 143 %MAKEOPTIONSAPPEND 144