1 # $NetBSD: Makefile.mips,v 1.55 2009/12/14 00:46:04 matt 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 20 USETOOLS?= no 21 NEED_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 ## 28 ELF2ECOFF?= elf2ecoff 29 30 ## 31 ## (1) port identification 32 ## 33 .ifndef S 34 S= ../../../.. 35 .endif 36 THISMIPS= $S/arch/${MACHINE} 37 MIPS= $S/arch/mips 38 GENASSYM_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 ## 46 CPPFLAGS+= -D${MACHINE} 47 DEFGP?= -G 0 48 GP?= ${DEFGP} 49 CFLAGS+= ${GP} -mno-abicalls -msoft-float -ffixed-23 50 .if defined(LP64) && ${LP64} == "yes" 51 .if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" 52 CFLAGS+= -msym32 -mabi=64 53 AFLAGS+= -msym32 -mabi=64 54 .endif 55 .if ${MACHINE_ARCH} == "mips64eb" 56 LDFLAGS+= -m elf64btsmip 57 LINKFORMAT+= -m elf64btsmip 58 SYSTEM_LD_TAIL_EXTRA+= \ 59 ;echo ${OBJCOPY} -O elf32-nbigmips $@ $@.elf32; \ 60 ${OBJCOPY} -O elf32-nbigmips $@ $@.elf32 61 .endif 62 .if ${MACHINE_ARCH} == "mips64el" 63 LDFLAGS+= -m elf64ltsmip 64 LINKFORMAT+= -m elf64ltsmip 65 SYSTEM_LD_TAIL_EXTRA+= \ 66 ;echo ${OBJCOPY} -O elf32-nlittlemips $@ $@.elf32; \ 67 ${OBJCOPY} -O elf32-nlittlemips $@ $@.elf32 68 .endif 69 .endif # LP64=yes 70 AFLAGS+= -mno-abicalls -x assembler-with-cpp -traditional-cpp ${AOPTS} 71 72 ## 73 ## (3) libkern and compat 74 ## 75 OPT_MODULAR= %MODULAR% 76 .if !empty(OPT_MODULAR) 77 KERN_AS= obj 78 .endif 79 80 ## 81 ## (4) local objects, compile rules, and dependencies 82 ## 83 MD_OBJS= locore.o locore_machdep.o 84 MD_CFILES= 85 MD_SFILES= ${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S 86 87 locore.o: ${MIPS}/mips/locore.S assym.h 88 ${NORMAL_S} 89 90 locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h 91 ${NORMAL_S} 92 93 ## 94 ## (5) link settings 95 ## 96 .if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" 97 TEXTADDR?= ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/} 98 .else 99 TEXTADDR?= ${DEFTEXTADDR} 100 .endif 101 KERNLDSCRIPT?= ${MIPS}/conf/kern.ldscript 102 # some mips ports specify a "magic" format 103 LINKFORMAT+= -T ${KERNLDSCRIPT} 104 EXTRA_LINKFLAGS= ${GP} ${LDOPTS} 105 LINKFLAGS_NORMAL= -X 106 STRIPFLAGS= -g -X 107 108 ## 109 ## (6) port specific target dependencies 110 ## 111 112 # depend on CPU configuration 113 machdep.o mainbus.o trap.o: Makefile 114 115 # depend on System V IPC/shmem options 116 mips_machdep.o pmap.o: Makefile 117 118 # various assembly files that depend on assym.h 119 copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h 120 lock_stubs.o mips32_subr.o mips3_subr.o mips5900_subr.o: assym.h 121 mips64_subr.o mipsX_subr.o sigcode.o: assym.h 122 123 124 ## 125 ## (7) misc settings 126 ## 127 128 ## 129 ## (8) config(8) generated machinery 130 ## 131 %INCLUDES 132 133 %OBJS 134 135 %CFILES 136 137 %SFILES 138 139 %LOAD 140 141 %RULES 142 143 ## 144 ## (9) port independent kernel machinery 145 ## 146 .include "$S/conf/Makefile.kern.inc" 147 148 ## 149 ## (10) Appending make options. 150 ## 151 %MAKEOPTIONSAPPEND 152