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