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