Makefile.sparc64 revision 1.31
1# $NetBSD: Makefile.sparc64,v 1.31 2000/09/28 19:56:15 eeh 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/sparc64/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/sparc64/conf/Makefile.sparc64 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.if defined(MAKECONF) && exists(${MAKECONF}) 25.include "${MAKECONF}" 26.elif exists(/etc/mk.conf) 27.include "/etc/mk.conf" 28.endif 29 30CC?= cc 31.if exists(/usr/ccs/bin/ld) 32LD?= /usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader 33.endif 34MKDEP?= mkdep 35STRIP?=strip 36SIZE?= size 37COPTS?= -O2 38#### Stuff for cross compiling 39NM?=nm 40LORDER?=lorder 41TSORT?=tsort 42 43 44# deal with Solaris vs. NetBSD build environments for now .. 45OS!=uname -s 46.if (${OS} == "NetBSD") 47USE_GENASSYM?= no 48.else 49USE_GENASSYM?= no 50AWK=nawk 51.endif 52 53.if exists(/usr/ccs/bin/ld) 54SVR4=-U__SVR4 -U__svr4__ -D__NetBSD__ 55.else 56SVR4= 57.endif 58 59# source tree is located via $S relative to the compilation directory 60.ifndef S 61S!= cd ../../../..; pwd 62.endif 63SPARC64= $S/arch/sparc64 64 65INCLUDES= -I. -I$S/arch -I$S -nostdinc 66CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4} 67CWARNFLAGS= -Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 68#CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes 69CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu 70.if defined(PROF) 71# We need to run the compiler in medlow memory model. 72CFLAGS += -mcmodel=medlow 73.endif 74AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a 75 76# 77# Gotta find a way to make kernel base tuneable. 78# 79 80LINKFLAGS= -Ttext 01000000 -Tdata 01400000 -e start 81 82#LINKFLAGS= -Ttext f1000000 -Tdata f1400000 -e start 83STRIPFLAGS= -g 84 85%INCLUDES 86 87### find out what to use for libkern 88# KERN_AS= obj # bcopy, bzero, memcpy, memset, etc. are in locore.s 89.include "$S/lib/libkern/Makefile.inc" 90.ifndef PROF 91LIBKERN= ${KERNLIB} 92.else 93LIBKERN= ${KERNLIB_PROF} 94.endif 95 96### find out what to use for libcompat 97.include "$S/compat/common/Makefile.inc" 98.ifndef PROF 99LIBCOMPAT= ${COMPATLIB} 100.else 101LIBCOMPAT= ${COMPATLIB_PROF} 102.endif 103 104# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 105# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 106 107NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 108NOOPT_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $< 109NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 110 111%OBJS 112 113%CFILES 114 115%SFILES 116 117# load lines for config "xxx" will be emitted as: 118# xxx: ${SYSTEM_DEP} swapxxx.o 119# ${SYSTEM_LD_HEAD} 120# ${SYSTEM_LD} swapxxx.o 121# ${SYSTEM_LD_TAIL} 122SYSTEM_OBJ= locore.o \ 123 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 124SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 125SYSTEM_LD_HEAD= rm -f $@ 126SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 127 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 128SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 129 130DEBUG?= 131.if ${DEBUG} == "-g" 132LINKFLAGS+= -X 133SYSTEM_LD_TAIL+=; \ 134 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 135 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 136 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 137.else 138LINKFLAGS+= -S 139.endif 140 141%LOAD 142 143.if ${USE_GENASSYM} == "no" 144assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf 145 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 146 < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \ 147 mv -f assym.h.tmp assym.h 148.else 149HOSTED_CC= ${CC} 150HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 151HOSTED_CFLAGS= ${CFLAGS} 152 153HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 154 155assym.h: genassym 156 ./genassym >assym.h 157 158genassym: genassym.o 159 ${CC} -o $@ genassym.o 160 161genassym.o: ${SPARC64}/sparc64/genassym.c 162 ${HOSTED_C} 163.endif 164 165param.c: $S/conf/param.c 166 rm -f param.c 167 cp $S/conf/param.c . 168 169param.o: param.c Makefile 170 ${NORMAL_C} 171 172ioconf.o: ioconf.c 173 ${NORMAL_C} 174 175newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 176 sh $S/conf/newvers.sh 177 ${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 178 179 180__CLEANKERNEL: .USE 181 @echo "${.TARGET}ing the kernel objects" 182 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 183 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 184 185__CLEANDEPEND: .USE 186 rm -f .depend 187 188clean: __CLEANKERNEL 189 190cleandir distclean: __CLEANKERNEL __CLEANDEPEND 191 192lint: 193 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 194 ${SPARC64}/sparc64/Locore.c ${CFILES} \ 195 ioconf.c param.c | \ 196 grep -v 'static function .* unused' 197 198tags: 199 @echo "see $S/kern/Makefile for tags" 200 201links: 202 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 203 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 204 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 205 sort -u | comm -23 - dontlink | \ 206 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 207 sh makelinks && rm -f dontlink 208 209SRCS= ${SPARC64}/sparc64/locore.s \ 210 param.c ioconf.c ${CFILES} ${SFILES} 211depend: .depend 212.depend: ${SRCS} assym.h param.c 213 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s 214 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 215.if (${SFILES} != "") 216 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 217.endif 218 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \ 219 ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf 220 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 221 @rm -f assym.dep 222 223dependall: depend all 224 225 226# depend on root or device configuration 227autoconf.o conf.o: Makefile 228 229# depend on network or filesystem configuration 230uipc_proto.o vfs_conf.o: Makefile 231 232# depend on maxusers 233machdep.o: Makefile 234 235# depend on CPU configuration 236bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile 237ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile 238machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile 239 240 241locore.o: ${SPARC64}/sparc64/locore.s assym.h 242 ${NORMAL_S} 243 244# The install target can be redefined by putting a 245# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 246MACHINE_NAME!= uname -n 247install: install-kernel-${MACHINE_NAME} 248.if !target(install-kernel-${MACHINE_NAME}}) 249install-kernel-${MACHINE_NAME}: 250 rm -f /onetbsd 251 ln /netbsd /onetbsd 252 cp netbsd /nnetbsd 253 mv /nnetbsd /netbsd 254.endif 255 256%RULES 257