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