Makefile.sun2 revision 1.1
1# $NetBSD: Makefile.sun2,v 1.1 2001/03/29 21:07:58 fredette 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/sun2/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/sun2/conf/Makefile.sun2 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=m68000 26MACHINE=sun2 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 47SUN2= $S/arch/sun2 48 49TEXTADDR=0000C000 50 51# Override CPP defaults entirely, so cross-compilation works. 52# Keep -nostdinc before all -I flags, similar for -undef ... 53HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 54INCLUDES= -nostdinc -I. -I$S/arch -I$S 55XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 56DEFINES= -D_KERNEL -Dsun2 57CPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 58# Make it easy to override this on the command line... 59CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 60 -Wpointer-arith 61# XXX Delete -Wuninitialized for now, since the compiler doesn't 62# XXX always get it right. --thorpej 63CWARNFLAGS+= -Wno-uninitialized 64.if (${HAVE_EGCS} != "") 65CWARNFLAGS+= -Wno-main 66.endif 67CFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 68APPFLAGS= -x assembler-with-cpp -P -traditional ${CPPFLAGS} -D_LOCORE 69AFLAGS= 70LINKFLAGS= -N -Ttext ${TEXTADDR} -e start 71STRIPFLAGS= -g 72 73%INCLUDES 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 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 133 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 134 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 135.else 136LINKFLAGS+= -S 137.endif 138 139# LOAD+ 140 141%LOAD 142 143# LOAD- 144 145# Use awk to cross-build assym.h from the genassym.s file. 146assym.h: genassym.o $S/kern/genassym.awk 147 awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 148 mv -f assym.h.tmp $@ 149 150# The above rule lists genassym.o as a prerequisite so that the 151# generated .depend rule is effective, even though we actually 152# use genassym.s instead. This always creates both. 153genassym.o: ${SUN2}/sun2/genassym.c 154 ${CC} ${CPPFLAGS} -S $< 155 ${CC} -c $*.s 156 157param.c: $S/conf/param.c 158 rm -f param.c 159 cp $S/conf/param.c . 160 161param.o: param.c Makefile 162 ${NORMAL_C} 163 164ioconf.o: ioconf.c 165 ${NORMAL_C} 166 167newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 168 sh $S/conf/newvers.sh 169 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 170 171__CLEANKERNEL: .USE 172 @echo "${.TARGET}ing the kernel objects" 173 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 174 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 175 176__CLEANDEPEND: .USE 177 rm -f .depend 178 179clean: __CLEANKERNEL 180 181cleandir distclean: __CLEANKERNEL __CLEANDEPEND 182 183lint: 184 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 185 ${CFILES} ioconf.c param.c | \ 186 grep -v 'static function .* unused' 187 188tags: 189 @echo "see $S/kern/Makefile for tags" 190 191links: 192 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 193 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 194 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 195 sort -u | comm -23 - dontlink | \ 196 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 197 sh makelinks && rm -f dontlink 198 199SRCS= ${SUN2}/sun2/locore.s \ 200 param.c ioconf.c ${CFILES} ${SFILES} 201 202depend: .depend 203.depend: ${SRCS} assym.h param.c 204 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 205 ${MKDEP} -a ${CPPFLAGS} ${SUN2}/sun2/genassym.c 206 207dependall: depend all 208 209 210# XXX - see below 211# ${MKDEP} -a ${APPFLAGS} ${SUN2}/sun2/locore.s 212# ${MKDEP} -a ${APPFLAGS} ${SFILES} 213# 214# For cross-compilation, the "gcc -M" mkdep script is convenient, 215# but that does not correctly make rules from *.s files. The 216# easiest work-around is to just list those dependencies here. 217locore.o: assym.h m68k/asm.h m68k/trap.h 218copy.o: assym.h m68k/asm.h $S/sys/errno.h 219bcopy.o: assym.h m68k/asm.h 220copypage.o: assym.h m68k/asm.h 221 222# depend on root or device configuration 223conf.o: Makefile 224 225# depend on network or filesystem configuration 226uipc_proto.o vfs_conf.o: Makefile 227 228# depend on maxusers 229machdep.o: Makefile 230 231# depend on CPU configuration 232db_machdep.o dvma.o machdep.o pmap.o sun2_startup.o vm_machdep.o: Makefile 233 234# depends on KGDBDEV, KGDBRATE 235kgdb_stub.o: Makefile 236 237# depends on DDB, etc. 238stub.o: Makefile 239 240locore.o: ${SUN2}/sun2/locore.s 241 ${NORMAL_S} 242 243# Generated rules follow: 244 245# The install target can be redefined by putting a 246# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 247MACHINE_NAME!= uname -n 248install: install-kernel-${MACHINE_NAME} 249.if !target(install-kernel-${MACHINE_NAME}}) 250install-kernel-${MACHINE_NAME}: 251 rm -f /onetbsd 252 ln /netbsd /onetbsd 253 cp netbsd /nnetbsd 254 mv /nnetbsd /netbsd 255.endif 256 257%RULES 258