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