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