Makefile.sun3 revision 1.87
1# $NetBSD: Makefile.sun3,v 1.87 2001/05/29 02:20:26 mrg 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__ -D__ELF__ 54DEFINES= -D_KERNEL -D_KERNEL_OPT -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} 66AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 67LINKFLAGS= -N -Ttext ${TEXTADDR} -e start 68STRIPFLAGS= -g 69 70%INCLUDES 71 72### find out what to use for libkern 73KERN_AS= obj 74.include "$S/lib/libkern/Makefile.inc" 75.ifndef PROF 76LIBKERN= ${KERNLIB} 77.else 78LIBKERN= ${KERNLIB_PROF} 79.endif 80 81### find out what to use for libcompat 82.include "$S/compat/common/Makefile.inc" 83.ifndef PROF 84LIBCOMPAT= ${COMPATLIB} 85.else 86LIBCOMPAT= ${COMPATLIB_PROF} 87.endif 88 89# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 90# the file suffix, capitalized (e.g. C for a .c file). 91 92NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 93NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 94NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 95 96# These comments help identify sections in the generated Makefile. 97# OBJS, CFILES, SFILES follow: 98 99%OBJS 100 101%CFILES 102 103%SFILES 104 105# OBJS, CFILES, SFILES done. 106 107# load lines for config "xxx" will be emitted as: 108# xxx: ${SYSTEM_DEP} swapxxx.o 109# ${SYSTEM_LD_HEAD} 110# ${SYSTEM_LD} swapxxx.o 111# ${SYSTEM_LD_TAIL} 112SYSTEM_OBJ= locore.o \ 113 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 114SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 115SYSTEM_LD_HEAD= @rm -f $@ 116SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 117 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 118SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 119 120DEBUG?= 121.if ${DEBUG} == "-g" 122LINKFLAGS+= -X 123SYSTEM_LD_TAIL+=; \ 124 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 125 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 126 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 127.else 128LINKFLAGS+= -S 129.endif 130 131# LOAD+ 132 133%LOAD 134 135# LOAD- 136 137assym.h: $S/kern/genassym.sh ${SUN3}/${MACHTYPE}/genassym.cf 138 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 139 < ${SUN3}/${MACHTYPE}/genassym.cf > assym.h.tmp && \ 140 mv -f assym.h.tmp assym.h 141 142param.c: $S/conf/param.c 143 rm -f param.c 144 cp $S/conf/param.c . 145 146param.o: param.c Makefile 147 ${NORMAL_C} 148 149ioconf.o: ioconf.c 150 ${NORMAL_C} 151 152newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 153 sh $S/conf/newvers.sh 154 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 155 156__CLEANKERNEL: .USE 157 @echo "${.TARGET}ing the kernel objects" 158 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 159 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 160 161__CLEANDEPEND: .USE 162 rm -f .depend 163 164clean: __CLEANKERNEL 165 166cleandir distclean: __CLEANKERNEL __CLEANDEPEND 167 168lint: 169 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 170 ${CFILES} ioconf.c param.c | \ 171 grep -v 'static function .* unused' 172 173tags: 174 @echo "see $S/kern/Makefile for tags" 175 176links: 177 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 178 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 179 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 180 sort -u | comm -23 - dontlink | \ 181 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 182 sh makelinks && rm -f dontlink 183 184SRCS= ${SUN3}/${MACHTYPE}/locore.s \ 185 param.c ioconf.c ${CFILES} ${SFILES} 186 187depend: .depend 188.depend: ${SRCS} assym.h param.c 189 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 190 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 191 ${CPPFLAGS} < ${SUN3}/${MACHTYPE}/genassym.cf 192 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 193 @rm -f assym.dep 194 195dependall: depend all 196 197 198# XXX - see below 199# ${MKDEP} -a ${APPFLAGS} ${SUN3}/${MACHTYPE}/locore.s 200# ${MKDEP} -a ${APPFLAGS} ${SFILES} 201# 202# For cross-compilation, the "gcc -M" mkdep script is convenient, 203# but that does not correctly make rules from *.s files. The 204# easiest work-around is to just list those dependencies here. 205locore.o: assym.h m68k/asm.h m68k/trap.h 206copy.o: assym.h m68k/asm.h $S/sys/errno.h 207bcopy.o: assym.h m68k/asm.h 208copypage.o: assym.h m68k/asm.h 209 210# depend on root or device configuration 211conf.o: Makefile 212 213# depend on network or filesystem configuration 214uipc_proto.o vfs_conf.o: Makefile 215 216# depend on maxusers 217machdep.o: Makefile 218 219# depend on CPU configuration 220db_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 221 222# depends on KGDBDEV, KGDBRATE 223kgdb_stub.o: Makefile 224 225# depends on DDB, etc. 226stub.o: Makefile 227 228locore.o: ${SUN3}/${MACHTYPE}/locore.s 229 ${NORMAL_S} 230 231# Generated rules follow: 232 233# The install target can be redefined by putting a 234# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 235MACHINE_NAME!= uname -n 236install: install-kernel-${MACHINE_NAME} 237.if !target(install-kernel-${MACHINE_NAME}}) 238install-kernel-${MACHINE_NAME}: 239 rm -f /onetbsd 240 ln /netbsd /onetbsd 241 cp netbsd /nnetbsd 242 mv /nnetbsd /netbsd 243.endif 244 245%RULES 246