Makefile.mips revision 1.65
1# $NetBSD: Makefile.mips,v 1.65 2016/03/29 18:40:32 macallan 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## 28ELF2ECOFF?= 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" && ${HAVE_GCC} == "48" 51# XXX 52# gcc does not pass floating point options to the assembler 53# by default, because it is afraid that the stricter tests 54# will break userland code. The new binutils is pickier about 55# this. Gcc 5.x fixes the issue so for now, set explicitly 56# the assembler soft-float flags when we build the kernel. 57# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64569 58 59CFLAGS+= -Wa,-msoft-float 60COPTS.mips_fpu.c+= -Wa,-mhard-float 61.else 62COPTS.mips_fpu.c+= -mhard-float -Wa,-mhard-float 63AFLAGS.fp.S+= -Wa,-mhard-float 64.endif 65 66CFLAGS+= ${GP} -mno-abicalls -msoft-float -ffixed-24 67.if defined(LP64) && ${LP64} == "yes" 68.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" 69CFLAGS+= -msym32 -mabi=64 70AFLAGS+= -msym32 -mabi=64 71.endif 72.if ${MACHINE_ARCH} == "mips64eb" 73LDFLAGS+= -m elf64btsmip 74LINKFORMAT+= -m elf64btsmip 75SYSTEM_LD_TAIL_EXTRA+= \ 76 ;echo ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32; \ 77 ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32 78.endif 79.if ${MACHINE_ARCH} == "mips64el" 80LDFLAGS+= -m elf64ltsmip 81LINKFORMAT+= -m elf64ltsmip 82SYSTEM_LD_TAIL_EXTRA+= \ 83 ;echo ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32; \ 84 ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32 85.endif 86.endif # LP64=yes 87AFLAGS+= -mno-abicalls -x assembler-with-cpp ${AOPTS} 88 89## 90## (3) libkern and compat 91## 92OPT_MODULAR= %MODULAR% 93.if !empty(OPT_MODULAR) 94KERN_AS= obj 95.else 96KERN_AS= library 97.endif 98 99## 100## (4) local objects, compile rules, and dependencies 101## 102MD_OBJS= locore.o locore_machdep.o 103MD_CFILES= 104MD_SFILES= ${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S 105 106locore.o: ${MIPS}/mips/locore.S assym.h 107 ${NORMAL_S} 108 109locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h 110 ${NORMAL_S} 111 112## 113## (5) link settings 114## 115.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" 116TEXTADDR?= ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/} 117.else 118TEXTADDR?= ${DEFTEXTADDR} 119.endif 120KERNLDSCRIPT?= ${MIPS}/conf/kern.ldscript 121# some mips ports specify a "magic" format 122EXTRA_LINKFLAGS= ${GP} ${LDOPTS} 123LINKFLAGS_NORMAL= -X 124STRIPFLAGS= -g -X 125 126## 127## (6) port specific target dependencies 128## 129 130# depend on CPU configuration 131machdep.o mainbus.o trap.o: Makefile 132 133# depend on System V IPC/shmem options 134mips_machdep.o pmap.o: Makefile 135 136# various assembly files that depend on assym.h 137copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h 138lock_stubs.o mips32_subr.o mips3_subr.o: assym.h 139mips64_subr.o mipsX_subr.o sigcode.o: assym.h 140 141 142## 143## (7) misc settings 144## 145 146## 147## (8) config(8) generated machinery 148## 149%INCLUDES 150 151%OBJS 152 153%CFILES 154 155%SFILES 156 157%LOAD 158 159%RULES 160 161## 162## (9) port independent kernel machinery 163## 164.include "$S/conf/Makefile.kern.inc" 165 166## 167## (10) Appending make options. 168## 169%MAKEOPTIONSAPPEND 170