1# $NetBSD: Makefile.mips,v 1.73 2023/07/26 03:41:57 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/<machine>/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/mips/conf/Makefile.mips 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## (0) toolchain settings for things that aren't part of the standard 26## toolchain 27## 28MIPS_ELF2ECOFF?= elf2ecoff 29 30## 31## (1) port identification 32## 33.ifndef S 34S= ../../../.. 35.endif 36THISMIPS= $S/arch/${MACHINE} 37MIPS= $S/arch/mips 38GENASSYM_CONF= ${MIPS}/mips/genassym.cf 39.-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc" 40 41## 42## (2) compile settings 43## 44## Note: -ffixed-?? must be kept in sync with cpu.h. 45## 46CPPFLAGS+= -D${MACHINE} 47DEFGP?= -G 0 48GP?= ${DEFGP} 49 50.if ${ACTIVE_CC} == "gcc" 51COPTS.mips_fpu.c+= -mhard-float -Wa,-mhard-float 52AFLAGS.fp.S+= -Wa,-mhard-float 53.endif 54 55CFLAGS+= ${GP} -mno-abicalls -msoft-float -ffixed-24 56.if defined(LP64) && ${LP64} == "yes" 57.if ${MACHINE_MIPS64} 58CFLAGS+= -msym32 -mabi=64 59AFLAGS+= -msym32 -mabi=64 60.endif 61.if !empty(MACHINE_ARCH:Mmips*64eb) 62LDFLAGS+= -Wl,-m,elf64btsmip 63LINKFORMAT+= -m elf64btsmip 64SYSTEM_LD_TAIL_EXTRA+= \ 65 ;echo ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32; \ 66 ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32 67.endif 68.if !empty(MACHINE_ARCH:Mmips*64el) 69LDFLAGS+= -Wl,-m,elf64ltsmip 70LINKFORMAT+= -m elf64ltsmip 71SYSTEM_LD_TAIL_EXTRA+= \ 72 ;echo ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32; \ 73 ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32 74.endif 75.endif # LP64=yes 76AFLAGS+= -mno-abicalls -x assembler-with-cpp ${AOPTS} 77 78## 79## (3) libkern and compat 80## 81OPT_MODULAR= %MODULAR% 82 83## 84## (4) local objects, compile rules, and dependencies 85## 86MD_OBJS= locore.o locore_machdep.o 87MD_CFILES= 88MD_SFILES= ${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S 89 90locore.o: ${MIPS}/mips/locore.S assym.h 91 ${NORMAL_S} 92 93locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h 94 ${NORMAL_S} 95 96## 97## (5) link settings 98## 99.if ${MACHINE_MIPS64} 100TEXTADDR?= ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/} 101.else 102TEXTADDR?= ${DEFTEXTADDR} 103.endif 104KERNLDSCRIPT?= ${MIPS}/conf/kern.ldscript 105# some mips ports specify a "magic" format 106EXTRA_LINKFLAGS= ${GP} ${LDOPTS} 107LINKFLAGS_NORMAL= -X 108OBJCOPY_STRIPFLAGS= -g -X 109 110## 111## (6) port specific target dependencies 112## 113 114# depend on CPU configuration 115machdep.o mainbus.o trap.o: Makefile 116 117# depend on System V IPC/shmem options 118mips_machdep.o pmap.o: Makefile 119 120# various assembly files that depend on assym.h 121copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h 122lock_stubs.o mips32_subr.o mips3_subr.o: assym.h 123mips64_subr.o mipsX_subr.o sigcode.o: assym.h 124 125 126## 127## (7) misc settings 128## 129 130## 131## (8) config(8) generated machinery 132## 133%INCLUDES 134 135%OBJS 136 137%CFILES 138 139%SFILES 140 141%LOAD 142 143%RULES 144 145## 146## (9) port independent kernel machinery 147## 148.include "$S/conf/Makefile.kern.inc" 149 150## 151## (10) Appending make options. 152## 153%MAKEOPTIONSAPPEND 154