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