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