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