Makefile.sun3 revision 1.68
1# $NetBSD: Makefile.sun3,v 1.68 1998/04/12 23:47:45 tv 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_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo 58INCLUDES= -nostdinc -I. -I$S/arch -I$S 59XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 60DEFINES= -D_KERNEL -Dmc68020 -Dsun3 61CPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 62# Make it easy to override this on the command line... 63CWARNFLAGS?= -Wall -Wstrict-prototypes # -Wmissing-prototypes -Werror 64.if (${HAVE_GCC28} != "") 65CWARNFLAGS+= -Wno-main 66.endif 67CFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 68# No, we may NOT assume that the compiler does -x whatever... 69APPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 70AFLAGS= 71LINKFLAGS= -N -Ttext ${TEXTADDR} -e start 72STRIPFLAGS= -d 73 74### find out what to use for libkern 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 $< 94 95# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 96# This needs an intermediate file. The original file is always 97# safe in some far away directory, so just use the base name. 98NORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 99 ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 100 101# These comments help identify sections in the generated Makefile. 102# OBJS, CFILES, SFILES follow: 103 104%OBJS 105 106%CFILES 107 108%SFILES 109 110# OBJS, CFILES, SFILES done. 111 112# load lines for config "xxx" will be emitted as: 113# xxx: ${SYSTEM_DEP} swapxxx.o 114# ${SYSTEM_LD_HEAD} 115# ${SYSTEM_LD} swapxxx.o 116# ${SYSTEM_LD_TAIL} 117SYSTEM_OBJ= locore.o \ 118 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 119SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 120SYSTEM_LD_HEAD= @rm -f $@ 121SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 122 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 123SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 124 125DEBUG?= 126.if ${DEBUG} == "-g" 127LINKFLAGS+= -X 128SYSTEM_LD_TAIL+=; \ 129 mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 130 ${STRIP} ${STRIPFLAGS} $@ 131.else 132LINKFLAGS+= -S 133.endif 134 135# LOAD+ 136 137%LOAD 138 139# LOAD- 140 141# Use awk to cross-build assym.h from the genassym.s file. 142assym.h: genassym.o $S/kern/genassym.awk 143 awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 144 mv -f assym.h.tmp $@ 145 146# The above rule lists genassym.o as a prerequisite so that the 147# generated .depend rule is effective, even though we actually 148# use genassym.s instead. This always creates both. 149genassym.o: ${SUN3}/${MACHTYPE}/genassym.c 150 ${CC} ${CPPFLAGS} -S $< 151 ${CC} -c $*.s 152 153param.c: $S/conf/param.c 154 rm -f param.c 155 cp $S/conf/param.c . 156 157param.o: param.c Makefile 158 ${NORMAL_C} 159 160ioconf.o: ioconf.c 161 ${NORMAL_C} 162 163newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 164 sh $S/conf/newvers.sh 165 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 166 167__CLEANKERNEL: .USE 168 @echo "${.TARGET}ing the kernel objects" 169 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 170 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 171 172__CLEANDEPEND: .USE 173 rm -f .depend 174 175clean: __CLEANKERNEL 176 177cleandir: __CLEANKERNEL __CLEANDEPEND 178 179lint: 180 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 181 ${CFILES} ioconf.c param.c | \ 182 grep -v 'static function .* unused' 183 184tags: 185 @echo "see $S/kern/Makefile for tags" 186 187links: 188 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 189 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 190 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 191 sort -u | comm -23 - dontlink | \ 192 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 193 sh makelinks && rm -f dontlink 194 195SRCS= ${SUN3}/${MACHTYPE}/locore.s \ 196 param.c ioconf.c ${CFILES} ${SFILES} 197 198depend: .depend 199.depend: ${SRCS} assym.h param.c 200 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 201 ${MKDEP} -a ${CPPFLAGS} ${SUN3}/${MACHTYPE}/genassym.c 202 203# XXX - see below 204# ${MKDEP} -a ${APPFLAGS} ${SUN3}/${MACHTYPE}/locore.s 205# ${MKDEP} -a ${APPFLAGS} ${SFILES} 206# 207# For cross-compilation, the "gcc -M" mkdep script is convenient, 208# but that does not correctly make rules from *.s files. The 209# easiest work-around is to just list those dependencies here. 210locore.o: assym.h m68k/asm.h m68k/trap.h 211copy.o: assym.h m68k/asm.h $S/sys/errno.h 212bcopy.o: assym.h m68k/asm.h 213copypage.o: assym.h m68k/asm.h 214 215# depend on root or device configuration 216conf.o: Makefile 217 218# depend on network or filesystem configuration 219uipc_proto.o vfs_conf.o: Makefile 220 221# depend on maxusers 222machdep.o: Makefile 223 224# depend on CPU configuration 225db_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 226 227# depends on KGDBDEV, KGDBRATE 228kgdb_stub.o: Makefile 229 230# depends on DDB, etc. 231stub.o: Makefile 232 233locore.o: ${SUN3}/${MACHTYPE}/locore.s 234 ${NORMAL_S} 235 236# Generated rules follow: 237 238%RULES 239