1 # $NetBSD: Makefile.acorn32,v 1.7 2001/11/26 23:52:58 thorpej 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 cat ${ARM}/arm32/genassym.cf ${GENASSYM_EXTRAS} | \ 134 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 135 > assym.h.tmp && \ 136 mv -f assym.h.tmp assym.h 137 138 param.c: $S/conf/param.c 139 rm -f param.c 140 cp $S/conf/param.c . 141 142 param.o: param.c Makefile 143 ${NORMAL_C} 144 145 ioconf.o: ioconf.c 146 ${NORMAL_C} 147 148 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 149 sh $S/conf/newvers.sh 150 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 151 152 __CLEANKERNEL: .USE 153 @echo "${.TARGET}ing the kernel objects" 154 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 155 [Ee]rrs linterrs makelinks assym.h.tmp assym.h modedefs.c 156 157 __CLEANDEPEND: .USE 158 rm -f .depend 159 160 clean: __CLEANKERNEL 161 162 cleandir distclean: __CLEANKERNEL __CLEANDEPEND 163 164 lint: 165 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 166 ${ARM}/arm32/Locore.c ${CFILES} \ 167 ioconf.c param.c | \ 168 grep -v 'static function .* unused' 169 170 tags: 171 @echo "see $S/kern/Makefile for tags" 172 173 links: 174 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 175 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 176 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 177 sort -u | comm -23 - dontlink | \ 178 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 179 sh makelinks && rm -f dontlink 180 181 SRCS= ${ARM}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} 182 .ifdef MONITOR 183 SRCS+= modedefs.c 184 .endif 185 depend: .depend 186 .depend: ${SRCS} assym.h param.c 187 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm32/locore.S 188 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 189 test -z "${SFILES}" || ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 190 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 191 ${CPPFLAGS} < ${ARM}/arm32/genassym.cf 192 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 193 @rm -f assym.dep 194 .ifdef MONITOR 195 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} modedefs.c 196 .endif 197 198 dependall: depend all 199 200 201 # depend on root or device configuration 202 autoconf.o conf.o: Makefile 203 204 # depend on network 205 uipc_proto.o: Makefile 206 207 # depend on maxusers 208 assym.h: Makefile 209 210 # depend on CPU configuration 211 cpufunc.o cpufunc_asm.o: Makefile 212 213 # depend on DIAGNOSTIC etc. 214 cpuswitch.o fault.o machdep.o: Makefile 215 216 217 locore.o: ${ARM}/arm32/locore.S assym.h 218 ${NORMAL_S} 219 220 modedefs.c: ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} Makefile 221 awk -f ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} ${MODES} >modedefs.c 222 223 modedefs.o: modedefs.c 224 ${NORMAL_C} 225 226 # The install target can be redefined by putting a 227 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 228 MACHINE_NAME!= uname -n 229 install: install-kernel-${MACHINE_NAME} 230 .if !target(install-kernel-${MACHINE_NAME}}) 231 install-kernel-${MACHINE_NAME}: 232 rm -f /onetbsd 233 ln /netbsd /onetbsd 234 cp netbsd /nnetbsd 235 mv /nnetbsd /netbsd 236 .endif 237 238 %RULES 239