Makefile.mvme68k revision 1.53
1# $NetBSD: Makefile.mvme68k,v 1.53 2001/10/26 06:45:38 jmc 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/mvme68k/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/mvme68k/conf/Makefile.mvme68k 13# after which config should be rerun for all machines of that type. 14 15MACHINE_ARCH=m68k 16USETOOLS?= no 17 18.include <bsd.own.mk> 19 20# DEBUG is set to -g if debugging. 21# PROF is set to -pg if profiling. 22 23AR?= ar 24AS?= as 25CC?= cc 26CPP?= cpp 27LD?= ld 28LORDER?=lorder 29MKDEP?= mkdep 30NM?= nm 31RANLIB?=ranlib 32SIZE?= size 33STRIP?= strip 34TSORT?= tsort -q 35 36COPTS?= -O2 37 38# source tree is located via $S relative to the compilation directory 39.ifndef S 40S!= cd ../../../..; pwd 41.endif 42MVME68K=$S/arch/mvme68k 43 44# Override CPP defaults entirely, so cross-compilation works. 45# Keep -nostdinc before all -I flags, similar for -undef ... 46HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 47INCLUDES= -nostdinc -I. -I$S/arch -I$S 48CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dmvme68k 49.if empty(IDENT:M-DMVME172) && empty(IDENT:M-DMVME177) 50.if empty(IDENT:M-DMVME147) 51CMACHFLAGS= -m68040 52.else 53CMACHFLAGS= -m68030 54.endif 55.else 56.if empty(IDENT:M-DMVME147) && empty(IDENT:M-DMVME162) && empty(IDENT:M-DMVME167) 57CMACHFLAGS= -m68060 -Wa,-m68030 -Wa,-m68851 58.else 59CMACHFLAGS= -m68020-60 -Wa,-m68030 -Wa,-m68851 60.endif 61.endif 62CWARNFLAGS?= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \ 63 -Wpointer-arith 64# XXX Delete -Wuninitialized for now, since the compiler doesn't 65# XXX always get it right. --thorpej 66CWARNFLAGS+= -Wno-uninitialized 67.if (${HAVE_EGCS} != "") 68CWARNFLAGS+= -Wno-main 69.endif 70CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} ${CMACHFLAGS} -msoft-float 71AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 72LINKFLAGS= -n -Ttext 8000 -e start 73STRIPFLAGS= -g 74 75%INCLUDES 76 77HOSTED_CC= ${CC} 78HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 79HOSTED_CFLAGS= ${CFLAGS} 80 81### find out what to use for libkern 82KERN_AS= obj 83.include "$S/lib/libkern/Makefile.inc" 84.ifndef PROF 85LIBKERN= ${KERNLIB} 86.else 87LIBKERN= ${KERNLIB_PROF} 88.endif 89 90### find out what to use for libcompat 91.include "$S/compat/common/Makefile.inc" 92.ifndef PROF 93LIBCOMPAT= ${COMPATLIB} 94.else 95LIBCOMPAT= ${COMPATLIB_PROF} 96.endif 97 98### for the Motorola 68040 Floating Point Software Product 99.include "$S/arch/m68k/fpsp/Makefile.inc" 100 101### for the Motorola 68060 Software Support Package 102.include "$S/arch/m68k/060sp/Makefile.inc" 103 104# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 105# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 106 107NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 108NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 109NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 110 111HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 112 113%OBJS 114 115%CFILES 116 117%SFILES 118 119# load lines for config "xxx" will be emitted as: 120# xxx: ${SYSTEM_DEP} swapxxx.o 121# ${SYSTEM_LD_HEAD} 122# ${SYSTEM_LD} swapxxx.o 123# ${SYSTEM_LD_TAIL} 124SYSTEM_OBJ= locore.o ${FPSP} \ 125 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 126SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 127SYSTEM_LD_HEAD= @rm -f $@ 128SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 129 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 130SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 131 132DEBUG?= 133.if ${DEBUG} == "-g" 134LINKFLAGS+= -X 135SYSTEM_LD_TAIL+=; \ 136 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 137 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 138 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 139.else 140LINKFLAGS+= -S 141.endif 142 143%LOAD 144 145assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf 146 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 147 < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \ 148 mv -f assym.h.tmp assym.h 149 150param.c: $S/conf/param.c 151 rm -f param.c 152 cp $S/conf/param.c . 153 154param.o: param.c Makefile 155 ${NORMAL_C} 156 157ioconf.o: ioconf.c 158 ${NORMAL_C} 159 160newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 161 sh $S/conf/newvers.sh 162 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 163 164__CLEANKERNEL: .USE 165 @echo "${.TARGET}ing the kernel objects" 166 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 167 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 168 169__CLEANDEPEND: .USE 170 rm -f .depend 171 172clean: __CLEANKERNEL 173 174cleandir distclean: __CLEANKERNEL __CLEANDEPEND 175 176lint: 177 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 178 ${CFILES} ioconf.c param.c | \ 179 grep -v 'static function .* unused' 180 181tags: 182 @echo "see $S/kern/Makefile for tags" 183 184links: 185 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 186 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 187 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 188 sort -u | comm -23 - dontlink | \ 189 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 190 sh makelinks && rm -f dontlink 191 192SRCS= ${MVME68K}/mvme68k/locore.s \ 193 param.c ioconf.c ${CFILES} ${SFILES} 194depend: .depend 195.depend: ${SRCS} assym.h param.c 196 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s 197 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 198 -if test -n "${SFILES}"; then \ 199 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \ 200 fi 201 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 202 ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf 203 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 204 @rm -f assym.dep 205 206dependall: depend all 207 208 209# depend on root or device configuration 210autoconf.o conf.o: Makefile 211 212# depend on network or filesystem configuration 213uipc_proto.o vfs_conf.o: Makefile 214 215# depend on maxusers 216machdep.o: Makefile 217 218# depend on CPU configuration 219locore.o pmap.o sys_machdep.o trap.o: Makefile 220 221 222locore.o: ${MVME68K}/mvme68k/locore.s assym.h 223 ${NORMAL_S} 224 225# The install target can be redefined by putting a 226# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 227MACHINE_NAME!= uname -n 228install: install-kernel-${MACHINE_NAME} 229.if !target(install-kernel-${MACHINE_NAME}}) 230install-kernel-${MACHINE_NAME}: 231 rm -f /onetbsd 232 ln /netbsd /onetbsd 233 cp netbsd /nnetbsd 234 mv /nnetbsd /netbsd 235.endif 236 237%RULES 238