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