1# $NetBSD: Makefile.arm,v 1.57 2023/07/28 02:41:30 rin 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 20USETOOLS?= no 21NEED_OWN_INSTALL_TARGET?=no 22.include <bsd.own.mk> 23 24## 25## (1) port identification 26## 27THISARM= $S/arch/${MACHINE} 28ARM= $S/arch/arm 29GENASSYM_CONF= ${ARM}/arm32/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. 36AFLAGS+= -x assembler-with-cpp 37COPTS.arm32_kvminit.c+= -fno-stack-protector 38COPTS.vfp_init.c= -mfpu=vfp 39CLANG_OBSOLETE_MULTI_ST= ${${ACTIVE_CC} == "clang":? -Wa,-W :} 40AFLAGS.bcopyinout.S+= -marm 41AFLAGS.blockio.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 42AFLAGS.copystr.S+= -marm 43AFLAGS.cpufunc_asm.S+= ${CLANG_OBSOLETE_MULTI_ST} 44AFLAGS.cpuswitch.S+= -marm -mfpu=vfp 45AFLAGS.exception.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 46AFLAGS.fiq_subr.S+= ${CLANG_OBSOLETE_MULTI_ST} 47AFLAGS.fusu.S+= -marm 48AFLAGS.irq_dispatch.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 49AFLAGS.locore.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 50CFLAGS+= -mfloat-abi=soft 51 52# This files use instructions deprecated for ARMv7+, but still 53# included in kernel that build with higher -mcpu=... settings. 54CPPFLAGS.cpufunc_asm_armv4.S+= -mcpu=arm8 55CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm1136j-s 56CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s 57CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale 58 59OPT_DDB= %DDB% 60.if !empty(OPT_DDB) && ${HAVE_GCC:U0} > 0 61CFLAGS+= -mapcs-frame 62.endif 63 64# Note: -fasan-shadow-offset= 65# KASAN_SHADOW_START - (__MD_KERNMEM_BASE >> KASAN_SHADOW_SCALE_SHIFT) = 66# 0xc000_0000 - (0x8000_0000 >> 3) = 0xb000_0000 67# 68 69.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 70KASANFLAGS= \ 71 -fsanitize=kernel-address \ 72 --param asan-globals=1 \ 73 --param asan-stack=1 \ 74 --param asan-instrument-allocas=1 \ 75 -fsanitize-address-use-after-scope \ 76 -fasan-shadow-offset=0xb0000000 77.for f in subr_asan.c 78KASANFLAGS.${f}= # empty 79.endfor 80CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}} 81.endif 82 83## 84## (3) libkern and compat 85## 86OPT_MODULAR= %MODULAR% 87 88## 89## (4) local objects, compile rules, and dependencies 90## 91MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 92MD_CFILES+= 93MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S 94 95.if defined(SYSTEM_FIRST_OBJ) 96${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 97 ${NORMAL_S} 98.endif 99 100locore.o: ${ARM}/arm32/locore.S assym.h 101 ${NORMAL_S} 102 103## 104## (5) link settings 105## 106LOADADDRESS?= 0xF0000000 107LINKFLAGS_NORMAL= -X 108# Strip ARM mapping symbols from the kernel image, as they interfere 109# with ddb, but don't strip them in netbsd.gdb. See Makefile.kern.inc. 110ARCH_STRIP_SYMBOLS= --strip-symbol='[$$][atd]' \ 111 --strip-symbol='[$$][atd]\.*' 112 113## 114## (6) port specific target dependencies 115## 116 117# depend on CPU configuration 118cpufunc.o cpufunc_asm.o: Makefile 119 120# depend on DIAGNOSTIC etc. 121cpuswitch.o fault.o machdep.o: Makefile 122 123# various assembly files that depend on assym.h 124atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 125exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h 126spl.o vectors.o: assym.h 127 128## 129## (7) misc settings 130## 131 132## 133## (8) config(8) generated machinery 134## 135%INCLUDES 136 137%OBJS 138 139%CFILES 140 141%SFILES 142 143%LOAD 144 145%RULES 146 147## 148## (9) after the config file is inserted 149## 150 151.for f in ${SFILES:T:Mcpufunc_asm*} 152AFLAGS.${f}+=-marm 153.endfor 154 155## 156## (10) port independent kernel machinery 157## 158 159.include "$S/conf/Makefile.kern.inc" 160 161## 162## (11) Appending make options. 163## 164%MAKEOPTIONSAPPEND 165