Makefile.acorn32 revision 1.3
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 15MACHINE_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 22AR?= ar 23AS?= as 24CC?= cc 25CPP?= cpp 26LD?= ld 27LORDER?=lorder 28MKDEP?= mkdep 29NM?= nm 30RANLIB?=ranlib 31SIZE?= size 32STRIP?= strip 33TSORT?= tsort -q 34 35COPTS?= -O2 36 37# source tree is located via $S relative to the compilation directory 38.ifndef S 39S!= cd ../../../..; pwd 40.endif 41ACORN32= $S/arch/acorn32 42ARM= $S/arch/arm 43 44HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 45INCLUDES= -I. -I$S/arch -I$S -nostdinc 46CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Darm32 47CWARNFLAGS?= -Werror -Wall -Wcomment -Wpointer-arith 48# XXX Delete -Wuninitialized for now, since the compiler doesn't 49# XXX always get it right. --thorpej 50CWARNFLAGS+= -Wno-uninitialized 51.if (${HAVE_EGCS} != "") 52CWARNFLAGS+= -Wno-main 53.endif 54CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 55AFLAGS= -x assembler-with-cpp -D_LOCORE 56 57LOADADDRESS= 0xF0000000 58LINKFLAGS= -Ttext ${LOADADDRESS} -e start 59STRIPFLAGS= -g 60 61%INCLUDES 62 63HOSTED_CC= ${CC} 64HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 65HOSTED_CFLAGS= ${CFLAGS} 66 67### find out what to use for libkern 68KERN_AS= obj 69.include "$S/lib/libkern/Makefile.inc" 70.ifndef PROF 71LIBKERN= ${KERNLIB} 72.else 73LIBKERN= ${KERNLIB_PROF} 74.endif 75 76### find out what to use for libcompat 77.include "$S/compat/common/Makefile.inc" 78.ifndef PROF 79LIBCOMPAT= ${COMPATLIB} 80.else 81LIBCOMPAT= ${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 87NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 88NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 89NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 90 91HOSTED_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 105SYSTEM_OBJ= locore.o modedefs.o \ 106 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 107.else 108SYSTEM_OBJ= locore.o \ 109 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 110.endif 111SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 112SYSTEM_LD_HEAD= rm -f $@ 113SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 114 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 115SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 116 117DEBUG?= 118.if ${DEBUG} == "-g" 119LINKFLAGS+= -X 120SYSTEM_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 126LINKFLAGS+= -x 127.endif 128 129%LOAD 130 131assym.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 136param.c: $S/conf/param.c 137 rm -f param.c 138 cp $S/conf/param.c . 139 140param.o: param.c Makefile 141 ${NORMAL_C} 142 143ioconf.o: ioconf.c 144 ${NORMAL_C} 145 146newvers: ${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 158clean: __CLEANKERNEL 159 160cleandir distclean: __CLEANKERNEL __CLEANDEPEND 161 162lint: 163 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 164 ${ARM}/arm32/Locore.c ${CFILES} \ 165 ioconf.c param.c | \ 166 grep -v 'static function .* unused' 167 168tags: 169 @echo "see $S/kern/Makefile for tags" 170 171links: 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 179SRCS= ${ARM}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} 180.ifdef MONITOR 181SRCS+= modedefs.c 182.endif 183depend: .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 196dependall: depend all 197 198 199# depend on root or device configuration 200autoconf.o conf.o: Makefile 201 202# depend on network 203uipc_proto.o: Makefile 204 205# depend on maxusers 206assym.h: Makefile 207 208# depend on CPU configuration 209cpufunc.o cpufunc_asm.o: Makefile 210 211# depend on DIAGNOSTIC etc. 212cpuswitch.o fault.o machdep.o: Makefile 213 214 215locore.o: ${ARM}/arm32/locore.S assym.h 216 ${NORMAL_S} 217 218modedefs.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 221modedefs.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 226MACHINE_NAME!= uname -n 227install: install-kernel-${MACHINE_NAME} 228.if !target(install-kernel-${MACHINE_NAME}}) 229install-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