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