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