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