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