Makefile.sparc64 revision 1.41
1# $NetBSD: Makefile.sparc64,v 1.41 2001/10/24 19:12:18 thorpej 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 24.include <bsd.own.mk> 25 26# DEBUG is set to -g if debugging. 27# PROF is set to -pg if profiling. 28 29AR?= ar 30AS?= as 31CC?= cc 32CPP?= cpp 33LD?= ld 34LORDER?=lorder 35MKDEP?= mkdep 36NM?= nm 37RANLIB?=ranlib 38SIZE?= size 39STRIP?= strip 40TSORT?= tsort -q 41 42COPTS?= -O2 43 44# source tree is located via $S relative to the compilation directory 45.ifndef S 46S!= cd ../../../..; pwd 47.endif 48SPARC64= $S/arch/sparc64 49 50INCLUDES= -I. -I$S/arch -I$S -nostdinc 51CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64 52CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 53 -Wpointer-arith 54# XXX Delete -Wuninitialized for now, since the compiler doesn't 55# XXX always get it right. --thorpej 56CWARNFLAGS+= -Wno-uninitialized 57CWARNFLAGS+= -Wno-main 58.if ${LP64} == "yes" 59CPPFLAGS+= -D_LP64 60.endif 61 62CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu 63.if defined(PROF) 64# We need to run the compiler in medlow memory model. 65CFLAGS+= -mcmodel=medlow 66.endif 67AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a 68 69# 70# Gotta find a way to make kernel base tuneable. 71# 72 73LINKFLAGS= -Ttext 01000000 -Tdata 01800000 -e start 74#LINKFLAGS= -Ttext f1000000 -Tdata f1400000 -e start 75 76LINKFLAGS+= -n -T ${SPARC64}/conf/${KERN_LDSCRIPT} 77.if ${LP64} == "yes" 78KERN_LDSCRIPT?= kern.ldscript 79.else 80KERN_LDSCRIPT?= kern32.ldscript 81.endif 82 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 143assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf 144 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 145 < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \ 146 mv -f assym.h.tmp assym.h 147 148param.c: $S/conf/param.c 149 rm -f param.c 150 cp $S/conf/param.c . 151 152param.o: param.c Makefile 153 ${NORMAL_C} 154 155ioconf.o: ioconf.c 156 ${NORMAL_C} 157 158newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 159 sh $S/conf/newvers.sh 160 ${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 161 162 163__CLEANKERNEL: .USE 164 @echo "${.TARGET}ing the kernel objects" 165 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 166 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 167 168__CLEANDEPEND: .USE 169 rm -f .depend 170 171clean: __CLEANKERNEL 172 173cleandir distclean: __CLEANKERNEL __CLEANDEPEND 174 175lint: 176 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 177 ${SPARC64}/sparc64/Locore.c ${CFILES} \ 178 ioconf.c param.c | \ 179 grep -v 'static function .* unused' 180 181tags: 182 @echo "see $S/kern/Makefile for tags" 183 184links: 185 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 186 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 187 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 188 sort -u | comm -23 - dontlink | \ 189 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 190 sh makelinks && rm -f dontlink 191 192SRCS= ${SPARC64}/sparc64/locore.s \ 193 param.c ioconf.c ${CFILES} ${SFILES} 194depend: .depend 195.depend: ${SRCS} assym.h param.c 196 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s 197 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 198.if (${SFILES} != "") 199 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 200.endif 201 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \ 202 ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf 203 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 204 @rm -f assym.dep 205 206dependall: depend all 207 208 209# depend on root or device configuration 210autoconf.o conf.o: Makefile 211 212# depend on network or filesystem configuration 213uipc_proto.o vfs_conf.o: Makefile 214 215# depend on maxusers 216machdep.o: Makefile 217 218# depend on CPU configuration 219bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile 220ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile 221machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile 222 223 224locore.o: ${SPARC64}/sparc64/locore.s assym.h 225 ${NORMAL_S} 226 227# The install target can be redefined by putting a 228# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 229MACHINE_NAME!= uname -n 230install: install-kernel-${MACHINE_NAME} 231.if !target(install-kernel-${MACHINE_NAME}}) 232install-kernel-${MACHINE_NAME}: 233 rm -f /onetbsd 234 ln /netbsd /onetbsd 235 cp netbsd /nnetbsd 236 mv /nnetbsd /netbsd 237.endif 238 239%RULES 240