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