Makefile.sun3 revision 1.85
1# $NetBSD: Makefile.sun3,v 1.85 2001/02/04 01:26:44 tsutsui 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/sun3/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/sun3/conf/Makefile.sun3 13# after which config should be rerun for all machines of that type. 14 15# DEBUG is set to -g if debugging. 16# PROF is set to -pg if profiling. 17 18# XXX - Make cross-build work... 19MACHINE_ARCH=m68k 20MACHINE=sun3 21 22AR?= ar 23AS?= as 24CC?= cc 25CPP?= cpp 26LD?= ld 27LORDER?=lorder 28MKDEP?= mkdep 29NM?= nm 30RANLIB?=ranlib 31SIZE?= size 32STRIP?= strip 33TSORT?= tsort -q 34 35COPTS?= -O2 -fno-defer-pop 36 37# source tree is located via $S relative to the compilation directory 38.ifndef S 39S!= cd ../../../..; pwd 40.endif 41SUN3= $S/arch/sun3 42 43.if ${MACHTYPE} == "sun3x" 44TEXTADDR=F8004000 45.else 46TEXTADDR=0E004000 47.endif 48 49# Override CPP defaults entirely, so cross-compilation works. 50# Keep -nostdinc before all -I flags, similar for -undef ... 51HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 52INCLUDES= -nostdinc -I. -I$S/arch -I$S 53XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 -D__m68k__ 54DEFINES= -D_KERNEL -Dsun3 55CPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 56# Make it easy to override this on the command line... 57CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 58 -Wpointer-arith 59# XXX Delete -Wuninitialized for now, since the compiler doesn't 60# XXX always get it right. --thorpej 61CWARNFLAGS+= -Wno-uninitialized 62.if (${HAVE_EGCS} != "") 63CWARNFLAGS+= -Wno-main 64.endif 65CFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 66# No, we may NOT assume that the compiler does -x whatever... 67APPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 68AFLAGS= 69LINKFLAGS= -N -Ttext ${TEXTADDR} -e start 70STRIPFLAGS= -g 71 72%INCLUDES 73 74### find out what to use for libkern 75KERN_AS= obj 76.include "$S/lib/libkern/Makefile.inc" 77.ifndef PROF 78LIBKERN= ${KERNLIB} 79.else 80LIBKERN= ${KERNLIB_PROF} 81.endif 82 83### find out what to use for libcompat 84.include "$S/compat/common/Makefile.inc" 85.ifndef PROF 86LIBCOMPAT= ${COMPATLIB} 87.else 88LIBCOMPAT= ${COMPATLIB_PROF} 89.endif 90 91# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 92# the file suffix, capitalized (e.g. C for a .c file). 93 94NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 95NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 96 97# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 98# This needs an intermediate file. The original file is always 99# safe in some far away directory, so just use the base name. 100NORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 101 ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 102 103# These comments help identify sections in the generated Makefile. 104# OBJS, CFILES, SFILES follow: 105 106%OBJS 107 108%CFILES 109 110%SFILES 111 112# OBJS, CFILES, SFILES done. 113 114# load lines for config "xxx" will be emitted as: 115# xxx: ${SYSTEM_DEP} swapxxx.o 116# ${SYSTEM_LD_HEAD} 117# ${SYSTEM_LD} swapxxx.o 118# ${SYSTEM_LD_TAIL} 119SYSTEM_OBJ= locore.o \ 120 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 121SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 122SYSTEM_LD_HEAD= @rm -f $@ 123SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 124 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 125SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 126 127DEBUG?= 128.if ${DEBUG} == "-g" 129LINKFLAGS+= -X 130SYSTEM_LD_TAIL+=; \ 131 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 132 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 133 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 134.else 135LINKFLAGS+= -S 136.endif 137 138# LOAD+ 139 140%LOAD 141 142# LOAD- 143 144assym.h: $S/kern/genassym.sh ${SUN3}/${MACHTYPE}/genassym.cf 145 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 146 < ${SUN3}/${MACHTYPE}/genassym.cf > assym.h.tmp && \ 147 mv -f assym.h.tmp assym.h 148 149param.c: $S/conf/param.c 150 rm -f param.c 151 cp $S/conf/param.c . 152 153param.o: param.c Makefile 154 ${NORMAL_C} 155 156ioconf.o: ioconf.c 157 ${NORMAL_C} 158 159newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 160 sh $S/conf/newvers.sh 161 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 162 163__CLEANKERNEL: .USE 164 @echo "${.TARGET}ing the kernel objects" 165 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 166 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 167 168__CLEANDEPEND: .USE 169 rm -f .depend 170 171clean: __CLEANKERNEL 172 173cleandir distclean: __CLEANKERNEL __CLEANDEPEND 174 175lint: 176 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 177 ${CFILES} ioconf.c param.c | \ 178 grep -v 'static function .* unused' 179 180tags: 181 @echo "see $S/kern/Makefile for tags" 182 183links: 184 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 185 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 186 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 187 sort -u | comm -23 - dontlink | \ 188 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 189 sh makelinks && rm -f dontlink 190 191SRCS= ${SUN3}/${MACHTYPE}/locore.s \ 192 param.c ioconf.c ${CFILES} ${SFILES} 193 194depend: .depend 195.depend: ${SRCS} assym.h param.c 196 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 197 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 198 ${CPPFLAGS} < ${SUN3}/${MACHTYPE}/genassym.cf 199 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 200 @rm -f assym.dep 201 202dependall: depend all 203 204 205# XXX - see below 206# ${MKDEP} -a ${APPFLAGS} ${SUN3}/${MACHTYPE}/locore.s 207# ${MKDEP} -a ${APPFLAGS} ${SFILES} 208# 209# For cross-compilation, the "gcc -M" mkdep script is convenient, 210# but that does not correctly make rules from *.s files. The 211# easiest work-around is to just list those dependencies here. 212locore.o: assym.h m68k/asm.h m68k/trap.h 213copy.o: assym.h m68k/asm.h $S/sys/errno.h 214bcopy.o: assym.h m68k/asm.h 215copypage.o: assym.h m68k/asm.h 216 217# depend on root or device configuration 218conf.o: Makefile 219 220# depend on network or filesystem configuration 221uipc_proto.o vfs_conf.o: Makefile 222 223# depend on maxusers 224machdep.o: Makefile 225 226# depend on CPU configuration 227db_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 228 229# depends on KGDBDEV, KGDBRATE 230kgdb_stub.o: Makefile 231 232# depends on DDB, etc. 233stub.o: Makefile 234 235locore.o: ${SUN3}/${MACHTYPE}/locore.s 236 ${NORMAL_S} 237 238# Generated rules follow: 239 240# The install target can be redefined by putting a 241# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 242MACHINE_NAME!= uname -n 243install: install-kernel-${MACHINE_NAME} 244.if !target(install-kernel-${MACHINE_NAME}}) 245install-kernel-${MACHINE_NAME}: 246 rm -f /onetbsd 247 ln /netbsd /onetbsd 248 cp netbsd /nnetbsd 249 mv /nnetbsd /netbsd 250.endif 251 252%RULES 253