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