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