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