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