Makefile.sun3 revision 1.67
1# $NetBSD: Makefile.sun3,v 1.67 1998/02/05 04:56:30 gwr 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 ... 57INCLUDES= -nostdinc -I. -I$S/arch -I$S 58XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 59DEFINES= -D_KERNEL -Dmc68020 -Dsun3 60CPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 61# Make it easy to override this on the command line... 62CWARNFLAGS= -Wall -Wstrict-prototypes # -Wmissing-prototypes -Werror 63CFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 64# No, we may NOT assume that the compiler does -x whatever... 65APPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 66AFLAGS= 67LINKFLAGS= -N -Ttext ${TEXTADDR} -e start 68STRIPFLAGS= -d 69 70### find out what to use for libkern 71.include "$S/lib/libkern/Makefile.inc" 72.ifndef PROF 73LIBKERN= ${KERNLIB} 74.else 75LIBKERN= ${KERNLIB_PROF} 76.endif 77 78### find out what to use for libcompat 79.include "$S/compat/common/Makefile.inc" 80.ifndef PROF 81LIBCOMPAT= ${COMPATLIB} 82.else 83LIBCOMPAT= ${COMPATLIB_PROF} 84.endif 85 86# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 87# the file suffix, capitalized (e.g. C for a .c file). 88 89NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 90 91# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 92# This needs an intermediate file. The original file is always 93# safe in some far away directory, so just use the base name. 94NORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 95 ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 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} ${LIBKERN} ${LIBCOMPAT} 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 mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 126 ${STRIP} ${STRIPFLAGS} $@ 127.else 128LINKFLAGS+= -S 129.endif 130 131# LOAD+ 132 133%LOAD 134 135# LOAD- 136 137# Use awk to cross-build assym.h from the genassym.s file. 138assym.h: genassym.o $S/kern/genassym.awk 139 awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 140 mv -f assym.h.tmp $@ 141 142# The above rule lists genassym.o as a prerequisite so that the 143# generated .depend rule is effective, even though we actually 144# use genassym.s instead. This always creates both. 145genassym.o: ${SUN3}/${MACHTYPE}/genassym.c 146 ${CC} ${CPPFLAGS} -S $< 147 ${CC} -c $*.s 148 149param.c: $S/conf/param.c 150 rm -f param.c 151 cp $S/conf/param.c . 152 153param.o: param.c Makefile 154 ${NORMAL_C} 155 156ioconf.o: ioconf.c 157 ${NORMAL_C} 158 159newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 160 sh $S/conf/newvers.sh 161 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 162 163__CLEANKERNEL: .USE 164 @echo "${.TARGET}ing the kernel objects" 165 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 166 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 167 168__CLEANDEPEND: .USE 169 rm -f .depend 170 171clean: __CLEANKERNEL 172 173cleandir: __CLEANKERNEL __CLEANDEPEND 174 175lint: 176 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 177 ${CFILES} ioconf.c param.c | \ 178 grep -v 'static function .* unused' 179 180tags: 181 @echo "see $S/kern/Makefile for tags" 182 183links: 184 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 185 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 186 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 187 sort -u | comm -23 - dontlink | \ 188 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 189 sh makelinks && rm -f dontlink 190 191SRCS= ${SUN3}/${MACHTYPE}/locore.s \ 192 param.c ioconf.c ${CFILES} ${SFILES} 193 194depend: .depend 195.depend: ${SRCS} assym.h param.c 196 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 197 ${MKDEP} -a ${CPPFLAGS} ${SUN3}/${MACHTYPE}/genassym.c 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 KGDBDEV, KGDBRATE 224kgdb_stub.o: Makefile 225 226# depends on DDB, etc. 227stub.o: Makefile 228 229locore.o: ${SUN3}/${MACHTYPE}/locore.s 230 ${NORMAL_S} 231 232# Generated rules follow: 233 234%RULES 235