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