1 # $NetBSD: Makefile.mips,v 1.25 2001/12/09 05:00:46 atatat 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 AR?= ${CROSSDIR}ar 25 AS?= ${CROSSDIR}as 26 CC?= ${CROSSDIR}cc 27 LD?= ${CROSSDIR}ld 28 NM?= ${CROSSDIR}nm 29 RANLIB?= ${CROSSDIR}ranlib 30 SIZE?= ${CROSSDIR}size 31 STRIP?= ${CROSSDIR}strip 32 TSORT?= ${CROSSDIR}tsort -q 33 OBJCOPY?= ${CROSSDIR}objcopy 34 35 ## 36 ## (1) port identification 37 ## 38 .if ${MACHINE_ARCH} == "mipsel" 39 ENDIAN=-EL 40 .elif ${MACHINE_ARCH} == "mipseb" 41 ENDIAN=-EB 42 .else 43 .BEGIN: 44 @echo "MACHINE_ARCH ${MACHINE_ARCH} is invalid" 45 @false 46 .endif 47 .ifndef S 48 S= ../../../.. 49 .endif 50 THISMIPS= $S/arch/${MACHINE} 51 MIPS= $S/arch/mips 52 GENASSYM= ${MIPS}/mips/genassym.cf 53 .-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc" 54 55 ## 56 ## (2) compile settings 57 ## 58 CPPFLAGS+= -D${MACHINE} 59 DEFGP?= -G 0 60 GP?= ${DEFGP} 61 CFLAGS+= ${ENDIAN} ${GP} -mno-abicalls -mno-half-pic 62 AFLAGS+= ${ENDIAN} -x assembler-with-cpp -traditional-cpp 63 64 ## 65 ## (3) libkern and compat 66 ## 67 68 ## 69 ## (4) local objects, compile rules, and dependencies 70 ## 71 MD_OBJS= locore.o locore_machdep.o 72 MD_CFILES= 73 MD_SFILES= ${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S 74 75 locore.o: ${MIPS}/mips/locore.S assym.h 76 ${NORMAL_S} 77 78 locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h 79 ${NORMAL_S} 80 81 .if !empty(IDENT:M-DMIPS1) 82 MD_OBJS+= locore_mips1.o 83 MD_SFILES+= ${MIPS}/mips/locore_mips1.S 84 locore_mips1.o: ${MIPS}/mips/locore_mips1.S assym.h 85 ${NORMAL_S} 86 .endif 87 88 .if !empty(IDENT:M-DMIPS3) 89 MD_OBJS+= locore_mips3.o 90 MD_SFILES+= ${MIPS}/mips/locore_mips3.S 91 locore_mips3.o: ${MIPS}/mips/locore_mips3.S assym.h 92 ${NORMAL_S} 93 .endif 94 95 .if !empty(IDENT:M-DMIPS3_5900) 96 MD_OBJS+= locore_r5900.o 97 MD_SFILES+= ${MIPS}/mips/r5900/locore_r5900.S 98 locore_r5900.o: ${MIPS}/mips/r5900/locore_r5900.S assym.h 99 ${NORMAL_S} 100 101 MD_OBJS+= r5900_machdep.o 102 MD_CFILES+= ${MIPS}/mips/r5900/r5900_machdep.c 103 r5900_machdep.o: ${MIPS}/mips/r5900/r5900_machdep.c 104 ${NORMAL_C} 105 .endif 106 107 .if empty(IDENT:M-DNOFPU) 108 MD_OBJS+= fp.o 109 MD_SFILES+= ${MIPS}/mips/fp.S 110 fp.o: ${MIPS}/mips/fp.S assym.h 111 ${NORMAL_S} 112 .endif 113 114 ## 115 ## (5) link settings 116 ## 117 TEXTADDR?= ${DEFTEXTADDR} 118 KERNLDSCRIPT?= ${MIPS}/conf/kern.ldscript 119 # some mips ports specify a "magic" format 120 LINKFORMAT+= -T ${KERNLDSCRIPT} 121 EXTRA_LINKFLAGS= ${ENDIAN} ${GP} 122 .if (${ENDIAN} == "-EB") 123 EXTRA_LINKFLAGS+= --oformat elf32-bigmips 124 .else 125 EXTRA_LINKFLAGS+= --oformat elf32-littlemips 126 .endif 127 LINKFLAGS_NORMAL= -x 128 STRIPFLAGS= -g -X -x 129 130 ## 131 ## (6) port specific target dependencies 132 ## 133 134 # depend on CPU configuration 135 machdep.o mainbus.o trap.o: Makefile 136 137 # depend on System V IPC/shmem options 138 mips_machdep.o pmap.o: Makefile 139 140 ## 141 ## (7) misc settings 142 ## 143 144 ## 145 ## (8) config(8) generated machinery 146 ## 147 %INCLUDES 148 149 %OBJS 150 151 %CFILES 152 153 %SFILES 154 155 %LOAD 156 157 %RULES 158 159 ## 160 ## (9) port independent kernel machinery 161 ## 162 .include "$S/conf/Makefile.kern.inc" 163