Makefile.mips revision 1.7
1# $NetBSD: Makefile.mips,v 1.7 2000/12/03 07:44:43 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# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17# 18# -DTRACE compile in kernel tracing hooks 19# -DQUOTA compile in file system quotas 20 21# DEBUG is set to -g if debugging. 22# PROF is set to -pg if profiling. 23 24AR?= ar 25AS?= as 26CC?= cc 27CPP?= cpp 28LD?= ld 29LORDER?= lorder 30MKDEP?= mkdep 31NM?= nm 32RANLIB?= ranlib 33SIZE?= size 34STRIP?= strip 35TSORT?= tsort -q 36 37COPTS?= -O2 38 39TEXTADDR?= ${DEFTEXTADDR} 40 41# source tree is located via $S relative to the compilation directory 42.ifndef S 43S= ../../../.. 44.endif 45THISMIPS= $S/arch/${TARGET_MACHINE} 46MIPS= $S/arch/mips 47 48HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 49INCLUDES= -I. -I$S/arch -I$S -nostdinc 50CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D${TARGET_MACHINE} 51CWARNFLAGS?= -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes \ 52 -Wpointer-arith 53# XXX Delete -Wuninitialized for now, since the compiler doesn't 54# XXX always get it right. --thorpej 55CWARNFLAGS+= -Wno-uninitialized 56.if (${HAVE_EGCS} != "") 57CWARNFLAGS+= -Wno-main 58.endif 59GP?= -G 0 60CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} ${GP} \ 61 -mno-abicalls -mno-half-pic 62AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 63LINKFLAGS+= -Ttext ${TEXTADDR} -e start ${GP} 64.if (${ENDIAN} == "-EB") 65LINKFLAGS+= -T ${MIPS}/conf/kern.ldscript.be 66CFLAGS+= -EB 67AFLAGS+= -EB 68LD+= -EB 69.else 70LINKFLAGS+= -T ${MIPS}/conf/kern.ldscript.le 71CFLAGS+= -EL 72AFLAGS+= -EL 73LD+= -EL 74.endif 75STRIPFLAGS= -g -X -x 76 77.if exists(${THISMIPS}/conf/Makefile.${TARGET_MACHINE}.inc) 78.include "${THISMIPS}/conf/Makefile.${TARGET_MACHINE}.inc" 79.endif 80 81%INCLUDES 82 83### find out what to use for libkern 84.include "$S/lib/libkern/Makefile.inc" 85.ifndef PROF 86LIBKERN= ${KERNLIB} 87.else 88LIBKERN= ${KERNLIB_PROF} 89.endif 90 91### find out what to use for libcompat 92.include "$S/compat/common/Makefile.inc" 93.ifndef PROF 94LIBCOMPAT= ${COMPATLIB} 95.else 96LIBCOMPAT= ${COMPATLIB_PROF} 97.endif 98 99# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 100# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 101 102NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 103NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 104NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 105 106%OBJS 107 108%CFILES 109 110%SFILES 111 112# load lines for config "xxx" will be emitted as: 113# xxx: ${SYSTEM_DEP} swapxxx.o 114# ${SYSTEM_LD_HEAD} 115# ${SYSTEM_LD} swapxxx.o 116# ${SYSTEM_LD_TAIL} 117SYSTEM_OBJ= locore.o locore_machdep.o 118.if !empty(IDENT:M-DMIPS1) 119SYSTEM_OBJ+= locore_mips1.o 120.endif 121.if !empty(IDENT:M-DMIPS3) 122SYSTEM_OBJ+= locore_mips3.o 123.endif 124.if empty(IDENT:M-DNOFPU) 125SYSTEM_OBJ+= fp.o 126.endif 127SYSTEM_OBJ+= param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 128SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 129SYSTEM_LD_HEAD?=@rm -f $@ 130SYSTEM_LD?= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ; \ 131 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 132SYSTEM_LD_TAIL?= \ 133 @${SIZE} $@; chmod 755 $@ 134 135DEBUG?= 136.if ${DEBUG} == "-g" 137LINKFLAGS+= -X 138.ifdef DEBUG_SYSTEM_LD_TAIL 139SYSTEM_LD_TAIL+=${DEBUG_SYSTEM_LD_TAIL} 140.else 141SYSTEM_LD_TAIL+=; \ 142 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 143 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 144 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 145.endif 146.else 147LINKFLAGS+= -x 148.endif 149 150.ifdef POST_STRIP_SYSTEM_LD_TAIL 151SYSTEM_LD_TAIL+=${POST_STRIP_SYSTEM_LD_TAIL} 152.endif 153 154%LOAD 155 156assym.h: $S/kern/genassym.sh ${MIPS}/mips/genassym.cf 157 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 158 < ${MIPS}/mips/genassym.cf > assym.h.tmp && \ 159 mv -f assym.h.tmp assym.h 160 161 162param.c: $S/conf/param.c 163 rm -f param.c 164 cp $S/conf/param.c . 165 166param.o: param.c Makefile 167 ${NORMAL_C} 168 169ioconf.o: ioconf.c 170 ${NORMAL_C} 171 172newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 173 sh $S/conf/newvers.sh 174 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 175 176__CLEANKERNEL: .USE 177 @echo "${.TARGET}ing the kernel objects" 178 rm -f eddep *netbsd netbsd.ecoff netbsd.gdb tags *.[io] \ 179 [a-z]*.s [Ee]rrs linterrs makelinks assym.h.tmp assym.h 180 181__CLEANDEPEND: .USE 182 rm -f .depend 183 184clean: __CLEANKERNEL 185 186cleandir distclean: __CLEANKERNEL __CLEANDEPEND 187 188lint: 189 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 190 ${MIPS}/mips/Locore.c ${CFILES} \ 191 ioconf.c param.c | \ 192 grep -v 'static function .* unused' 193 194tags: 195 @echo "see $S/kern/Makefile for tags" 196 197links: 198 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 199 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 200 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 201 sort -u | comm -23 - dontlink | \ 202 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 203 sh makelinks && rm -f dontlink 204 205SRCS= ${MIPS}/mips/locore.S \ 206 ${THISMIPS}/${TARGET_MACHINE}/locore_machdep.S \ 207 param.c ioconf.c ${CFILES} ${SFILES} 208.if !empty(IDENT:M-DMIPS1) 209SRCS+= ${MIPS}/mips/locore_mips1.S 210.endif 211.if !empty(IDENT:M-DMIPS3) 212SRCS+= ${MIPS}/mips/locore_mips3.S 213.endif 214.if empty(IDENT:M-DNOFPU) 215SRCS+= ${MIPS}/mips/fp.S 216.endif 217 218depend: .depend 219.depend: ${SRCS} assym.h param.c 220 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MIPS}/mips/locore.S 221.if !empty(IDENT:M-DMIPS1) 222 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${MIPS}/mips/locore_mips1.S 223.endif 224.if !empty(IDENT:M-DMIPS3) 225 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${MIPS}/mips/locore_mips3.S 226.endif 227.if empty(IDENT:M-DNOFPU) 228 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${MIPS}/mips/fp.S 229.endif 230 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${THISMIPS}/${TARGET_MACHINE}/locore_machdep.S 231 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 232.if (${SFILES} != "") 233 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 234.endif 235 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 236 ${CPPFLAGS} < ${MIPS}/mips/genassym.cf 237 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 238 @rm -f assym.dep 239 240dependall: depend all 241 242 243# depend on root or device configuration 244autoconf.o conf.o: Makefile 245 246# depend on network or filesystem configuration 247uipc_proto.o vfs_conf.o: Makefile 248 249# depend on maxusers 250machdep.o: Makefile 251 252# depend on CPU configuration 253machdep.o mainbus.o trap.o: Makefile 254 255# depend on System V IPC/shmem options 256mips_machdep.o pmap.o: Makefile 257 258locore.o: ${MIPS}/mips/locore.S assym.h 259 ${NORMAL_S} 260 261locore_mips1.o: ${MIPS}/mips/locore_mips1.S assym.h 262 ${NORMAL_S} 263 264locore_mips3.o: ${MIPS}/mips/locore_mips3.S assym.h 265 ${NORMAL_S} 266 267fp.o: ${MIPS}/mips/fp.S assym.h 268 ${NORMAL_S} 269 270locore_machdep.o: ${THISMIPS}/${TARGET_MACHINE}/locore_machdep.S assym.h 271 ${NORMAL_S} 272 273# The install target can be redefined by putting a 274# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 275MACHINE_NAME!= uname -n 276install: install-kernel-${MACHINE_NAME} 277.if !target(install-kernel-${MACHINE_NAME}}) 278install-kernel-${MACHINE_NAME}: 279 rm -f /onetbsd 280 ln /netbsd /onetbsd 281 cp netbsd /nnetbsd 282 mv /nnetbsd /netbsd 283.endif 284 285%RULES 286