1 # $NetBSD: Makefile.acorn32,v 1.5 2001/11/20 12:56:17 lukem 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/acorn32/conf/``machineid'' 9 # after which you should do 10 # config machineid 11 # Machine generic makefile changes should be made in 12 # /sys/arch/acorn32/conf/Makefile.acorn32 13 # after which config should be rerun for all machines of that type. 14 15 MACHINE_ARCH=arm32 16 USETOOLS?= no 17 18 .include <bsd.own.mk> 19 20 # DEBUG is set to -g if debugging. 21 # PROF is set to -pg if profiling. 22 23 AR?= ar 24 AS?= as 25 CC?= cc 26 CPP?= cpp 27 LD?= ld 28 LORDER?=lorder 29 MKDEP?= mkdep 30 NM?= nm 31 RANLIB?=ranlib 32 SIZE?= size 33 STRIP?= strip 34 TSORT?= tsort -q 35 36 COPTS?= -O2 37 38 # source tree is located via $S relative to the compilation directory 39 .ifndef S 40 S!= cd ../../../..; pwd 41 .endif 42 ACORN32= $S/arch/acorn32 43 ARM= $S/arch/arm 44 45 HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 46 INCLUDES= -I. -I$S/arch -I$S -nostdinc 47 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Darm32 48 CWARNFLAGS?= -Werror -Wall -Wcomment -Wpointer-arith 49 # XXX Delete -Wuninitialized for now, since the compiler doesn't 50 # XXX always get it right. --thorpej 51 CWARNFLAGS+= -Wno-uninitialized 52 .if (${HAVE_EGCS} != "") 53 CWARNFLAGS+= -Wno-main 54 .endif 55 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 56 AFLAGS= -x assembler-with-cpp -D_LOCORE 57 58 LOADADDRESS= 0xF0000000 59 LINKFLAGS= -Ttext ${LOADADDRESS} -e start 60 STRIPFLAGS= -g 61 62 %INCLUDES 63 64 HOSTED_CC= ${CC} 65 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 66 HOSTED_CFLAGS= ${CFLAGS} 67 68 ### find out what to use for libkern 69 KERN_AS= obj 70 .include "$S/lib/libkern/Makefile.inc" 71 .ifndef PROF 72 LIBKERN= ${KERNLIB} 73 .else 74 LIBKERN= ${KERNLIB_PROF} 75 .endif 76 77 ### find out what to use for libcompat 78 .include "$S/compat/common/Makefile.inc" 79 .ifndef PROF 80 LIBCOMPAT= ${COMPATLIB} 81 .else 82 LIBCOMPAT= ${COMPATLIB_PROF} 83 .endif 84 85 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 86 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 87 88 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 89 NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 90 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 91 92 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 93 94 %OBJS 95 96 %CFILES 97 98 %SFILES 99 100 # load lines for config "xxx" will be emitted as: 101 # xxx: ${SYSTEM_DEP} swapxxx.o 102 # ${SYSTEM_LD_HEAD} 103 # ${SYSTEM_LD} swapxxx.o 104 # ${SYSTEM_LD_TAIL} 105 .ifdef MONITOR 106 SYSTEM_OBJ= locore.o modedefs.o \ 107 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 108 .else 109 SYSTEM_OBJ= locore.o \ 110 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 111 .endif 112 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 113 SYSTEM_LD_HEAD= rm -f $@ 114 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 115 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 116 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 117 118 DEBUG?= 119 .if ${DEBUG} == "-g" 120 LINKFLAGS+= -X 121 SYSTEM_LD_TAIL+=; \ 122 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 123 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 124 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 125 .else 126 #LINKFLAGS+= -S 127 LINKFLAGS+= -x 128 .endif 129 130 %LOAD 131 132 assym.h: $S/kern/genassym.sh ${ARM}/arm32/genassym.cf 133 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 134 < ${ARM}/arm32/genassym.cf > assym.h.tmp && \ 135 mv -f assym.h.tmp assym.h 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 __CLEANKERNEL: .USE 152 @echo "${.TARGET}ing the kernel objects" 153 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 154 [Ee]rrs linterrs makelinks assym.h.tmp assym.h modedefs.c 155 156 __CLEANDEPEND: .USE 157 rm -f .depend 158 159 clean: __CLEANKERNEL 160 161 cleandir distclean: __CLEANKERNEL __CLEANDEPEND 162 163 lint: 164 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 165 ${ARM}/arm32/Locore.c ${CFILES} \ 166 ioconf.c param.c | \ 167 grep -v 'static function .* unused' 168 169 tags: 170 @echo "see $S/kern/Makefile for tags" 171 172 links: 173 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 174 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 175 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 176 sort -u | comm -23 - dontlink | \ 177 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 178 sh makelinks && rm -f dontlink 179 180 SRCS= ${ARM}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} 181 .ifdef MONITOR 182 SRCS+= modedefs.c 183 .endif 184 depend: .depend 185 .depend: ${SRCS} assym.h param.c 186 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm32/locore.S 187 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 188 test -z "${SFILES}" || ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 189 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 190 ${CPPFLAGS} < ${ARM}/arm32/genassym.cf 191 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 192 @rm -f assym.dep 193 .ifdef MONITOR 194 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} modedefs.c 195 .endif 196 197 dependall: depend all 198 199 200 # depend on root or device configuration 201 autoconf.o conf.o: Makefile 202 203 # depend on network 204 uipc_proto.o: Makefile 205 206 # depend on maxusers 207 assym.h: Makefile 208 209 # depend on CPU configuration 210 cpufunc.o cpufunc_asm.o: Makefile 211 212 # depend on DIAGNOSTIC etc. 213 cpuswitch.o fault.o machdep.o: Makefile 214 215 216 locore.o: ${ARM}/arm32/locore.S assym.h 217 ${NORMAL_S} 218 219 modedefs.c: ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} Makefile 220 awk -f ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} ${MODES} >modedefs.c 221 222 modedefs.o: modedefs.c 223 ${NORMAL_C} 224 225 # The install target can be redefined by putting a 226 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 227 MACHINE_NAME!= uname -n 228 install: install-kernel-${MACHINE_NAME} 229 .if !target(install-kernel-${MACHINE_NAME}}) 230 install-kernel-${MACHINE_NAME}: 231 rm -f /onetbsd 232 ln /netbsd /onetbsd 233 cp netbsd /nnetbsd 234 mv /nnetbsd /netbsd 235 .endif 236 237 %RULES 238